mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-05 02:10:27 -07:00
Ansible test refactor (preparing for custom tests)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
11fb11c061
commit
6e397c7e4c
126 changed files with 9308 additions and 9182 deletions
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
108
tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml
Normal file
108
tests/integration/targets/gcp_bigquery_dataset/tasks/autogen.yml
Normal file
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
149
tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml
Normal file
149
tests/integration/targets/gcp_bigquery_table/tasks/autogen.yml
Normal file
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,155 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: 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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
105
tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml
Normal file
105
tests/integration/targets/gcp_cloudtasks_queue/tasks/autogen.yml
Normal file
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
109
tests/integration/targets/gcp_compute_address/tasks/autogen.yml
Normal file
109
tests/integration/targets/gcp_compute_address/tasks/autogen.yml
Normal file
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
124
tests/integration/targets/gcp_compute_disk/tasks/autogen.yml
Normal file
124
tests/integration/targets/gcp_compute_disk/tasks/autogen.yml
Normal file
|
@ -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 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
- include_tasks: autogen.yml
|
||||
|
|
147
tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml
Normal file
147
tests/integration/targets/gcp_compute_firewall/tasks/autogen.yml
Normal file
|
@ -0,0 +1,147 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a firewall
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that firewall was created
|
||||
gcp_compute_firewall_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 firewall that already exists
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a firewall
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that firewall was deleted
|
||||
gcp_compute_firewall_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 firewall that does not exist
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,147 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a firewall
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a firewall
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that firewall was created
|
||||
gcp_compute_firewall_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 firewall that already exists
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a firewall
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that firewall was deleted
|
||||
gcp_compute_firewall_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 firewall that does not exist
|
||||
gcp_compute_firewall:
|
||||
name: "{{ resource_name }}"
|
||||
allowed:
|
||||
- ip_protocol: tcp
|
||||
ports:
|
||||
- '22'
|
||||
target_tags:
|
||||
- test-ssh-server
|
||||
- staging-ssh-server
|
||||
source_tags:
|
||||
- test-ssh-clients
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: targetpool-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: targetpool
|
||||
- name: delete a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that forwarding_rule was created
|
||||
gcp_compute_forwarding_rule_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a forwarding rule that already exists
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that forwarding_rule was deleted
|
||||
gcp_compute_forwarding_rule_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a forwarding rule that does not exist
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: targetpool-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: targetpool
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
|
@ -1,170 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: targetpool-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: targetpool
|
||||
- name: delete a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that forwarding_rule was created
|
||||
gcp_compute_forwarding_rule_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a forwarding rule that already exists
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a forwarding rule
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that forwarding_rule was deleted
|
||||
gcp_compute_forwarding_rule_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a forwarding rule that does not exist
|
||||
gcp_compute_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target: "{{ targetpool }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
ip_address: "{{ address.address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: targetpool-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: targetpool
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-forwardingrule
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_address was created
|
||||
gcp_compute_global_address_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 global address that already exists
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_address was deleted
|
||||
gcp_compute_global_address_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 global address that does not exist
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,102 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_address was created
|
||||
gcp_compute_global_address_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 global address that already exists
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a global address
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_address was deleted
|
||||
gcp_compute_global_address_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 global address that does not exist
|
||||
gcp_compute_global_address:
|
||||
name: "{{ resource_name }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 global address
|
||||
gcp_compute_global_address:
|
||||
name: globaladdress-globalforwardingrule
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: globaladdress
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-globalforwardingrule
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-globalforwardingrule
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-globalforwardingrule
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-globalforwardingrule
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: create a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: targethttpproxy-globalforwardingrule
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: httpproxy
|
||||
- name: delete a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_forwarding_rule was created
|
||||
gcp_compute_global_forwarding_rule_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 global forwarding rule that already exists
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_forwarding_rule was deleted
|
||||
gcp_compute_global_forwarding_rule_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 global forwarding rule that does not exist
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: targethttpproxy-globalforwardingrule
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: httpproxy
|
||||
ignore_errors: true
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-globalforwardingrule
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-globalforwardingrule
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-globalforwardingrule
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-globalforwardingrule
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- name: delete a global address
|
||||
gcp_compute_global_address:
|
||||
name: globaladdress-globalforwardingrule
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: globaladdress
|
||||
ignore_errors: true
|
|
@ -1,251 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a global address
|
||||
gcp_compute_global_address:
|
||||
name: globaladdress-globalforwardingrule
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: globaladdress
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-globalforwardingrule
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-globalforwardingrule
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-globalforwardingrule
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-globalforwardingrule
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: create a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: targethttpproxy-globalforwardingrule
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: httpproxy
|
||||
- name: delete a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_forwarding_rule was created
|
||||
gcp_compute_global_forwarding_rule_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 global forwarding rule that already exists
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a global forwarding rule
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that global_forwarding_rule was deleted
|
||||
gcp_compute_global_forwarding_rule_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 global forwarding rule that does not exist
|
||||
gcp_compute_global_forwarding_rule:
|
||||
name: "{{ resource_name }}"
|
||||
ip_address: "{{ globaladdress.address }}"
|
||||
ip_protocol: TCP
|
||||
port_range: 80-80
|
||||
target: "{{ httpproxy.selfLink }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: targethttpproxy-globalforwardingrule
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: httpproxy
|
||||
ignore_errors: true
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-globalforwardingrule
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-globalforwardingrule
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-globalforwardingrule
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-globalforwardingrule
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- name: delete a global address
|
||||
gcp_compute_global_address:
|
||||
name: globaladdress-globalforwardingrule
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: globaladdress
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,142 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that health_check was created
|
||||
gcp_compute_health_check_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 health check that already exists
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that health_check was deleted
|
||||
gcp_compute_health_check_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 health check that does not exist
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,142 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that health_check was created
|
||||
gcp_compute_health_check_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 health check that already exists
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that health_check was deleted
|
||||
gcp_compute_health_check_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 health check that does not exist
|
||||
gcp_compute_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that http_health_check was created
|
||||
gcp_compute_http_health_check_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 HTTP health check that already exists
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that http_health_check was deleted
|
||||
gcp_compute_http_health_check_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 HTTP health check that does not exist
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,122 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that http_health_check was created
|
||||
gcp_compute_http_health_check_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 HTTP health check that already exists
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that http_health_check was deleted
|
||||
gcp_compute_http_health_check_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 HTTP health check that does not exist
|
||||
gcp_compute_http_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that https_health_check was created
|
||||
gcp_compute_https_health_check_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 HTTPS health check that already exists
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that https_health_check was deleted
|
||||
gcp_compute_https_health_check_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 HTTPS health check that does not exist
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,122 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that https_health_check was created
|
||||
gcp_compute_https_health_check_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 HTTPS health check that already exists
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a HTTPS health check
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that https_health_check was deleted
|
||||
gcp_compute_https_health_check_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 HTTPS health check that does not exist
|
||||
gcp_compute_https_health_check:
|
||||
name: "{{ resource_name }}"
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
129
tests/integration/targets/gcp_compute_image/tasks/autogen.yml
Normal file
129
tests/integration/targets/gcp_compute_image/tasks/autogen.yml
Normal file
|
@ -0,0 +1,129 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 disk
|
||||
gcp_compute_disk:
|
||||
name: disk-image
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: delete a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that image was created
|
||||
gcp_compute_image_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 image that already exists
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that image was deleted
|
||||
gcp_compute_image_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 image that does not exist
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-image
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
|
@ -1,129 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-image
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: delete a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that image was created
|
||||
gcp_compute_image_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 image that already exists
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a image
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that image was deleted
|
||||
gcp_compute_image_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 image that does not exist
|
||||
gcp_compute_image:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-image
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
251
tests/integration/targets/gcp_compute_instance/tasks/autogen.yml
Normal file
251
tests/integration/targets/gcp_compute_instance/tasks/autogen.yml
Normal file
|
@ -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 disk
|
||||
gcp_compute_disk:
|
||||
name: disk-instance
|
||||
size_gb: 50
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-instance
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-instance
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: delete a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was created
|
||||
gcp_compute_instance_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 instance that already exists
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was deleted
|
||||
gcp_compute_instance_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 instance that does not exist
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instance
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instance
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- name: delete a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-instance
|
||||
size_gb: 50
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
|
@ -1,251 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-instance
|
||||
size_gb: 50
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-instance
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-instance
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: delete a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was created
|
||||
gcp_compute_instance_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 instance that already exists
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was deleted
|
||||
gcp_compute_instance_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 instance that does not exist
|
||||
gcp_compute_instance:
|
||||
name: "{{ resource_name }}"
|
||||
machine_type: n1-standard-1
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
source: "{{ disk }}"
|
||||
metadata:
|
||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||
cost-center: '12345'
|
||||
labels:
|
||||
environment: production
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: External NAT
|
||||
nat_ip: "{{ address }}"
|
||||
type: ONE_TO_ONE_NAT
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instance
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instance
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- name: delete a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-instance
|
||||
size_gb: 50
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 network
|
||||
gcp_compute_network:
|
||||
name: network-instancegroup
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group was created
|
||||
gcp_compute_instance_group_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 instance group that already exists
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group was deleted
|
||||
gcp_compute_instance_group_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 instance group that does not exist
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancegroup
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,149 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-instancegroup
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group was created
|
||||
gcp_compute_instance_group_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 instance group that already exists
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group was deleted
|
||||
gcp_compute_instance_group_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 instance group that does not exist
|
||||
gcp_compute_instance_group:
|
||||
name: "{{ resource_name }}"
|
||||
named_ports:
|
||||
- name: ansible
|
||||
port: 1234
|
||||
network: "{{ network }}"
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancegroup
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancetemplate
|
||||
- name: delete a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group_manager was created
|
||||
gcp_compute_instance_group_manager_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a instance group manager that already exists
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group_manager was deleted
|
||||
gcp_compute_instance_group_manager_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a instance group manager that does not exist
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancetemplate
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,206 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancetemplate
|
||||
- name: delete a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group_manager was created
|
||||
gcp_compute_instance_group_manager_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a instance group manager that already exists
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance group manager
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_group_manager was deleted
|
||||
gcp_compute_instance_group_manager_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a instance group manager that does not exist
|
||||
gcp_compute_instance_group_manager:
|
||||
name: "{{ resource_name }}"
|
||||
base_instance_name: test1-child
|
||||
instance_template: "{{ instancetemplate }}"
|
||||
target_size: 3
|
||||
zone: us-west1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancetemplate
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_template was created
|
||||
gcp_compute_instance_template_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 instance template that already exists
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_template was deleted
|
||||
gcp_compute_instance_template_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 instance template that does not exist
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,206 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_template was created
|
||||
gcp_compute_instance_template_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 instance template that already exists
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance template
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance_template was deleted
|
||||
gcp_compute_instance_template_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 instance template that does not exist
|
||||
gcp_compute_instance_template:
|
||||
name: "{{ resource_name }}"
|
||||
properties:
|
||||
disks:
|
||||
- auto_delete: 'true'
|
||||
boot: 'true'
|
||||
initialize_params:
|
||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||
machine_type: n1-standard-1
|
||||
network_interfaces:
|
||||
- network: "{{ network }}"
|
||||
access_configs:
|
||||
- name: test-config
|
||||
type: ONE_TO_ONE_NAT
|
||||
nat_ip: "{{ address }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-instancetemplate
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-instancetemplate
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
107
tests/integration/targets/gcp_compute_network/tasks/autogen.yml
Normal file
107
tests/integration/targets/gcp_compute_network/tasks/autogen.yml
Normal file
|
@ -0,0 +1,107 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that network was created
|
||||
gcp_compute_network_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 network that already exists
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that network was deleted
|
||||
gcp_compute_network_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 network that does not exist
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,107 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that network was created
|
||||
gcp_compute_network_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 network that already exists
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that network was deleted
|
||||
gcp_compute_network_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 network that does not exist
|
||||
gcp_compute_network:
|
||||
name: "{{ resource_name }}"
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that region_disk was created
|
||||
gcp_compute_region_disk_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a region disk that already exists
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that region_disk was deleted
|
||||
gcp_compute_region_disk_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a region disk that does not exist
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,139 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that region_disk was created
|
||||
gcp_compute_region_disk_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a region disk that already exists
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a region disk
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that region_disk was deleted
|
||||
gcp_compute_region_disk_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a region disk that does not exist
|
||||
gcp_compute_region_disk:
|
||||
name: "{{ resource_name }}"
|
||||
size_gb: 500
|
||||
disk_encryption_key:
|
||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||
region: us-central1
|
||||
replica_zones:
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
152
tests/integration/targets/gcp_compute_route/tasks/autogen.yml
Normal file
152
tests/integration/targets/gcp_compute_route/tasks/autogen.yml
Normal file
|
@ -0,0 +1,152 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-route
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that route was created
|
||||
gcp_compute_route_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 route that already exists
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that route was deleted
|
||||
gcp_compute_route_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 route that does not exist
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-route
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,152 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-route
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that route was created
|
||||
gcp_compute_route_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 route that already exists
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a route
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that route was deleted
|
||||
gcp_compute_route_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 route that does not exist
|
||||
gcp_compute_route:
|
||||
name: "{{ resource_name }}"
|
||||
dest_range: 192.168.6.0/24
|
||||
next_hop_gateway: global/gateways/default-internet-gateway
|
||||
network: "{{ network }}"
|
||||
tags:
|
||||
- backends
|
||||
- databases
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-route
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
174
tests/integration/targets/gcp_compute_router/tasks/autogen.yml
Normal file
174
tests/integration/targets/gcp_compute_router/tasks/autogen.yml
Normal file
|
@ -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 network
|
||||
gcp_compute_network:
|
||||
name: network-router
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that router was created
|
||||
gcp_compute_router_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a router that already exists
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that router was deleted
|
||||
gcp_compute_router_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a router that does not exist
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-router
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,174 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-router
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that router was created
|
||||
gcp_compute_router_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a router that already exists
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that router was deleted
|
||||
gcp_compute_router_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a router that does not exist
|
||||
gcp_compute_router:
|
||||
name: "{{ resource_name }}"
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-router
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
144
tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml
Normal file
144
tests/integration/targets/gcp_compute_snapshot/tasks/autogen.yml
Normal file
|
@ -0,0 +1,144 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-snapshot
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: delete a snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot was created
|
||||
gcp_compute_snapshot_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 snapshot that already exists
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot was deleted
|
||||
gcp_compute_snapshot_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 snapshot that does not exist
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 disk
|
||||
gcp_compute_disk:
|
||||
name: disk-snapshot
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
|
@ -1,144 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a disk
|
||||
gcp_compute_disk:
|
||||
name: disk-snapshot
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: disk
|
||||
- name: delete a snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot was created
|
||||
gcp_compute_snapshot_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 snapshot that already exists
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 snapshot was deleted
|
||||
gcp_compute_snapshot_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 snapshot that does not exist
|
||||
gcp_compute_snapshot:
|
||||
name: "{{ resource_name }}"
|
||||
source_disk: "{{ disk }}"
|
||||
zone: us-central1-a
|
||||
labels:
|
||||
my_label: value
|
||||
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 disk
|
||||
gcp_compute_disk:
|
||||
name: disk-snapshot
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: disk
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,227 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_certificate was created
|
||||
gcp_compute_ssl_certificate_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 SSL certificate that already exists
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_certificate was deleted
|
||||
gcp_compute_ssl_certificate_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 SSL certificate that does not exist
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,227 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_certificate was created
|
||||
gcp_compute_ssl_certificate_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 SSL certificate that already exists
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_certificate was deleted
|
||||
gcp_compute_ssl_certificate_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 SSL certificate that does not exist
|
||||
gcp_compute_ssl_certificate:
|
||||
name: "{{ resource_name }}"
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_policy was created
|
||||
gcp_compute_ssl_policy_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 SSL policy that already exists
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_policy was deleted
|
||||
gcp_compute_ssl_policy_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 SSL policy that does not exist
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,127 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_policy was created
|
||||
gcp_compute_ssl_policy_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 SSL policy that already exists
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a SSL policy
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that ssl_policy was deleted
|
||||
gcp_compute_ssl_policy_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 SSL policy that does not exist
|
||||
gcp_compute_ssl_policy:
|
||||
name: "{{ resource_name }}"
|
||||
profile: CUSTOM
|
||||
min_tls_version: TLS_1_2
|
||||
custom_features:
|
||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-subnetwork
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that subnetwork was created
|
||||
gcp_compute_subnetwork_info:
|
||||
filters:
|
||||
- name = ansiblenet
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a subnetwork that already exists
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that subnetwork was deleted
|
||||
gcp_compute_subnetwork_info:
|
||||
filters:
|
||||
- name = ansiblenet
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a subnetwork that does not exist
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-subnetwork
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,141 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-subnetwork
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that subnetwork was created
|
||||
gcp_compute_subnetwork_info:
|
||||
filters:
|
||||
- name = ansiblenet
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a subnetwork that already exists
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a subnetwork
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that subnetwork was deleted
|
||||
gcp_compute_subnetwork_info:
|
||||
filters:
|
||||
- name = ansiblenet
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a subnetwork that does not exist
|
||||
gcp_compute_subnetwork:
|
||||
name: ansiblenet
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
ip_cidr_range: 172.16.0.0/16
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-subnetwork
|
||||
auto_create_subnetworks: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-targethttpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_http_proxy was created
|
||||
gcp_compute_target_http_proxy_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 target HTTP proxy that already exists
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_http_proxy was deleted
|
||||
gcp_compute_target_http_proxy_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 target HTTP proxy that does not exist
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
|
@ -1,200 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_http_proxy was created
|
||||
gcp_compute_target_http_proxy_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 target HTTP proxy that already exists
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target HTTP proxy
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_http_proxy was deleted
|
||||
gcp_compute_target_http_proxy_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 target HTTP proxy that does not exist
|
||||
gcp_compute_target_http_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,277 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-targethttpsproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpsproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpsproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpsproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targethttpsproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: sslcert
|
||||
- name: delete a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_https_proxy was created
|
||||
gcp_compute_target_https_proxy_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 target HTTPS proxy that already exists
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_https_proxy was deleted
|
||||
gcp_compute_target_https_proxy_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 target HTTPS proxy that does not exist
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targethttpsproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: sslcert
|
||||
ignore_errors: true
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpsproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpsproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpsproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpsproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
|
@ -1,277 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpsproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpsproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpsproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpsproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: urlmap
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targethttpsproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: sslcert
|
||||
- name: delete a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_https_proxy was created
|
||||
gcp_compute_target_https_proxy_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 target HTTPS proxy that already exists
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target HTTPS proxy
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_https_proxy was deleted
|
||||
gcp_compute_target_https_proxy_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 target HTTPS proxy that does not exist
|
||||
gcp_compute_target_https_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
url_map: "{{ urlmap }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targethttpsproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: sslcert
|
||||
ignore_errors: true
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: urlmap-targethttpsproxy
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: urlmap
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targethttpsproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-targethttpsproxy
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targethttpsproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -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 target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_pool was created
|
||||
gcp_compute_target_pool_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a target pool that already exists
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_pool was deleted
|
||||
gcp_compute_target_pool_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a target pool that does not exist
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,109 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_pool was created
|
||||
gcp_compute_target_pool_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a target pool that already exists
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target pool
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_pool was deleted
|
||||
gcp_compute_target_pool_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a target pool that does not exist
|
||||
gcp_compute_target_pool:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-targetsslproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targetsslproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targetsslproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: SSL
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: backendservice
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targetsslproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: sslcert
|
||||
- name: delete a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_ssl_proxy was created
|
||||
gcp_compute_target_ssl_proxy_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 target SSL proxy that already exists
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_ssl_proxy was deleted
|
||||
gcp_compute_target_ssl_proxy_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 target SSL proxy that does not exist
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targetsslproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: sslcert
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targetsslproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: SSL
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targetsslproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targetsslproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
|
@ -1,266 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targetsslproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targetsslproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targetsslproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: SSL
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: backendservice
|
||||
- name: create a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targetsslproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: sslcert
|
||||
- name: delete a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_ssl_proxy was created
|
||||
gcp_compute_target_ssl_proxy_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 target SSL proxy that already exists
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target SSL proxy
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_ssl_proxy was deleted
|
||||
gcp_compute_target_ssl_proxy_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 target SSL proxy that does not exist
|
||||
gcp_compute_target_ssl_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
ssl_certificates:
|
||||
- "{{ sslcert }}"
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a SSL certificate
|
||||
gcp_compute_ssl_certificate:
|
||||
name: sslcert-targetsslproxy
|
||||
description: A certificate for testing. Do not use this certificate in production
|
||||
certificate: |-
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||
zqGNhIPGq2ULqXKK8BY=
|
||||
-----END CERTIFICATE-----
|
||||
private_key: |-
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||
-----END EC PRIVATE KEY-----
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: sslcert
|
||||
ignore_errors: true
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targetsslproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: SSL
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targetsslproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targetsslproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,194 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-targettcpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targettcpproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targettcpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: TCP
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: backendservice
|
||||
- name: delete a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_tcp_proxy was created
|
||||
gcp_compute_target_tcp_proxy_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 target TCP proxy that already exists
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_tcp_proxy was deleted
|
||||
gcp_compute_target_tcp_proxy_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 target TCP proxy that does not exist
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targettcpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: TCP
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targettcpproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targettcpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
|
@ -1,194 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targettcpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targettcpproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targettcpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: TCP
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: backendservice
|
||||
- name: delete a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_tcp_proxy was created
|
||||
gcp_compute_target_tcp_proxy_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 target TCP proxy that already exists
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target TCP proxy
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_tcp_proxy was deleted
|
||||
gcp_compute_target_tcp_proxy_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 target TCP proxy that does not exist
|
||||
gcp_compute_target_tcp_proxy:
|
||||
name: "{{ resource_name }}"
|
||||
proxy_header: PROXY_V1
|
||||
service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-targettcpproxy
|
||||
backends:
|
||||
- group: "{{ instancegroup.selfLink }}"
|
||||
health_checks:
|
||||
- "{{ healthcheck.selfLink }}"
|
||||
protocol: TCP
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a health check
|
||||
gcp_compute_health_check:
|
||||
name: healthcheck-targettcpproxy
|
||||
type: TCP
|
||||
tcp_health_check:
|
||||
port_name: service-health
|
||||
request: ping
|
||||
response: pong
|
||||
healthy_threshold: 10
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-targettcpproxy
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 address
|
||||
gcp_compute_address:
|
||||
name: address-vpngateway
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-vpngateway
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_vpn_gateway was created
|
||||
gcp_compute_target_vpn_gateway_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a target vpn gateway that already exists
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_vpn_gateway was deleted
|
||||
gcp_compute_target_vpn_gateway_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a target vpn gateway that does not exist
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-vpngateway
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-vpngateway
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
|
@ -1,153 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a address
|
||||
gcp_compute_address:
|
||||
name: address-vpngateway
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: address
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-vpngateway
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_vpn_gateway was created
|
||||
gcp_compute_target_vpn_gateway_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a target vpn gateway that already exists
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that target_vpn_gateway was deleted
|
||||
gcp_compute_target_vpn_gateway_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a target vpn gateway that does not exist
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-vpngateway
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- name: delete a address
|
||||
gcp_compute_address:
|
||||
name: address-vpngateway
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: address
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
181
tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml
Normal file
181
tests/integration/targets/gcp_compute_url_map/tasks/autogen.yml
Normal file
|
@ -0,0 +1,181 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-urlmap
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-urlmap
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-urlmap
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that url_map was created
|
||||
gcp_compute_url_map_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 URL map that already exists
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that url_map was deleted
|
||||
gcp_compute_url_map_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 URL map that does not exist
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-urlmap
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-urlmap
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-urlmap
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
|
@ -1,181 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-urlmap
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instancegroup
|
||||
- name: create a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-urlmap
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: healthcheck
|
||||
- name: create a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-urlmap
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that url_map was created
|
||||
gcp_compute_url_map_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 URL map that already exists
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a URL map
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that url_map was deleted
|
||||
gcp_compute_url_map_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 URL map that does not exist
|
||||
gcp_compute_url_map:
|
||||
name: "{{ resource_name }}"
|
||||
default_service: "{{ backendservice }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a backend service
|
||||
gcp_compute_backend_service:
|
||||
name: backendservice-urlmap
|
||||
backends:
|
||||
- group: "{{ instancegroup.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: backendservice
|
||||
ignore_errors: true
|
||||
- name: delete a HTTP health check
|
||||
gcp_compute_http_health_check:
|
||||
name: httphealthcheck-urlmap
|
||||
healthy_threshold: 10
|
||||
port: 8080
|
||||
timeout_sec: 2
|
||||
unhealthy_threshold: 5
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: healthcheck
|
||||
ignore_errors: true
|
||||
- name: delete a instance group
|
||||
gcp_compute_instance_group:
|
||||
name: instancegroup-urlmap
|
||||
zone: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: instancegroup
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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-vpn-tunnel
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a router
|
||||
gcp_compute_router:
|
||||
name: router-vpn-tunnel
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: router
|
||||
- name: create a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: gateway-vpn-tunnel
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: gateway
|
||||
- name: delete a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that vpn_tunnel was created
|
||||
gcp_compute_vpn_tunnel_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a vpn tunnel that already exists
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that vpn_tunnel was deleted
|
||||
gcp_compute_vpn_tunnel_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a vpn tunnel that does not exist
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: gateway-vpn-tunnel
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: gateway
|
||||
ignore_errors: true
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: router-vpn-tunnel
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: router
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-vpn-tunnel
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
|
@ -1,202 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a network
|
||||
gcp_compute_network:
|
||||
name: network-vpn-tunnel
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: network
|
||||
- name: create a router
|
||||
gcp_compute_router:
|
||||
name: router-vpn-tunnel
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: router
|
||||
- name: create a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: gateway-vpn-tunnel
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: gateway
|
||||
- name: delete a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that vpn_tunnel was created
|
||||
gcp_compute_vpn_tunnel_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a vpn tunnel that already exists
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a vpn tunnel
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that vpn_tunnel was deleted
|
||||
gcp_compute_vpn_tunnel_info:
|
||||
filters:
|
||||
- name = {{ resource_name }}
|
||||
region: us-west1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/compute
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a vpn tunnel that does not exist
|
||||
gcp_compute_vpn_tunnel:
|
||||
name: "{{ resource_name }}"
|
||||
region: us-west1
|
||||
target_vpn_gateway: "{{ gateway }}"
|
||||
router: "{{ router }}"
|
||||
shared_secret: super secret
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a target vpn gateway
|
||||
gcp_compute_target_vpn_gateway:
|
||||
name: gateway-vpn-tunnel
|
||||
region: us-west1
|
||||
network: "{{ network }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: gateway
|
||||
ignore_errors: true
|
||||
- name: delete a router
|
||||
gcp_compute_router:
|
||||
name: router-vpn-tunnel
|
||||
network: "{{ network }}"
|
||||
bgp:
|
||||
asn: 64514
|
||||
advertise_mode: CUSTOM
|
||||
advertised_groups:
|
||||
- ALL_SUBNETS
|
||||
advertised_ip_ranges:
|
||||
- range: 1.2.3.4
|
||||
- range: 6.7.0.0/16
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: router
|
||||
ignore_errors: true
|
||||
- name: delete a network
|
||||
gcp_compute_network:
|
||||
name: network-vpn-tunnel
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: network
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that cluster was created
|
||||
gcp_container_cluster_info:
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a cluster that already exists
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that cluster was deleted
|
||||
gcp_container_cluster_info:
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a cluster that does not exist
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,140 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that cluster was created
|
||||
gcp_container_cluster_info:
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a cluster that already exists
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a cluster
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that cluster was deleted
|
||||
gcp_container_cluster_info:
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a cluster that does not exist
|
||||
gcp_container_cluster:
|
||||
name: my-cluster
|
||||
initial_node_count: 2
|
||||
master_auth:
|
||||
username: cluster_admin
|
||||
password: my-secret-password
|
||||
node_config:
|
||||
machine_type: n1-standard-4
|
||||
disk_size_gb: 500
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 cluster
|
||||
gcp_container_cluster:
|
||||
name: cluster-nodepool
|
||||
initial_node_count: 4
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: cluster
|
||||
- name: delete a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that node_pool was created
|
||||
gcp_container_node_pool_info:
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a node pool that already exists
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that node_pool was deleted
|
||||
gcp_container_node_pool_info:
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a node pool that does not exist
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a cluster
|
||||
gcp_container_cluster:
|
||||
name: cluster-nodepool
|
||||
initial_node_count: 4
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: cluster
|
||||
ignore_errors: true
|
|
@ -1,141 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a cluster
|
||||
gcp_container_cluster:
|
||||
name: cluster-nodepool
|
||||
initial_node_count: 4
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: cluster
|
||||
- name: delete a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that node_pool was created
|
||||
gcp_container_node_pool_info:
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a node pool that already exists
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a node pool
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that node_pool was deleted
|
||||
gcp_container_node_pool_info:
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a node pool that does not exist
|
||||
gcp_container_node_pool:
|
||||
name: my-pool
|
||||
initial_node_count: 4
|
||||
cluster: "{{ cluster }}"
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a cluster
|
||||
gcp_container_cluster:
|
||||
name: cluster-nodepool
|
||||
initial_node_count: 4
|
||||
location: us-central1-a
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: cluster
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
110
tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml
Normal file
110
tests/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml
Normal file
|
@ -0,0 +1,110 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that managed_zone was created
|
||||
gcp_dns_managed_zone_info:
|
||||
dns_name: test.somewild2.example.com.
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a managed zone that already exists
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that managed_zone was deleted
|
||||
gcp_dns_managed_zone_info:
|
||||
dns_name: test.somewild2.example.com.
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a managed zone that does not exist
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,110 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that managed_zone was created
|
||||
gcp_dns_managed_zone_info:
|
||||
dns_name: test.somewild2.example.com.
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a managed zone that already exists
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that managed_zone was deleted
|
||||
gcp_dns_managed_zone_info:
|
||||
dns_name: test.somewild2.example.com.
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a managed zone that does not exist
|
||||
gcp_dns_managed_zone:
|
||||
name: "{{ resource_name }}"
|
||||
dns_name: test.somewild2.example.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** 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 managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: managedzone-rrs
|
||||
dns_name: testzone-4.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: managed_zone
|
||||
- name: delete a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that resource_record_set was created
|
||||
gcp_dns_resource_record_set_info:
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a resource record set that already exists
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that resource_record_set was deleted
|
||||
gcp_dns_resource_record_set_info:
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a resource record set that does not exist
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: managedzone-rrs
|
||||
dns_name: testzone-4.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: managed_zone
|
||||
ignore_errors: true
|
|
@ -1,154 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: managedzone-rrs
|
||||
dns_name: testzone-4.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: managed_zone
|
||||
- name: delete a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that resource_record_set was created
|
||||
gcp_dns_resource_record_set_info:
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a resource record set that already exists
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a resource record set
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that resource_record_set was deleted
|
||||
gcp_dns_resource_record_set_info:
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\""
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a resource record set that does not exist
|
||||
gcp_dns_resource_record_set:
|
||||
name: www.testzone-4.com.
|
||||
managed_zone: "{{ managed_zone }}"
|
||||
type: A
|
||||
ttl: 600
|
||||
target:
|
||||
- 10.1.2.3
|
||||
- 40.5.6.7
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a managed zone
|
||||
gcp_dns_managed_zone:
|
||||
name: managedzone-rrs
|
||||
dns_name: testzone-4.com.
|
||||
description: test zone
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: managed_zone
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was created
|
||||
gcp_filestore_instance_info:
|
||||
zone: us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a instance that already exists
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was deleted
|
||||
gcp_filestore_instance_info:
|
||||
zone: us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a instance that does not exist
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
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,145 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was created
|
||||
gcp_filestore_instance_info:
|
||||
zone: us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a instance that already exists
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a instance
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that instance was deleted
|
||||
gcp_filestore_instance_info:
|
||||
zone: us-central1-b
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a instance that does not exist
|
||||
gcp_filestore_instance:
|
||||
name: "{{ resource_name }}"
|
||||
zone: us-central1-b
|
||||
tier: PREMIUM
|
||||
file_shares:
|
||||
- capacity_gb: 2660
|
||||
name: share1
|
||||
networks:
|
||||
- network: default
|
||||
modes:
|
||||
- MODE_IPV4
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
128
tests/integration/targets/gcp_iam_role/tasks/autogen.yml
Normal file
128
tests/integration/targets/gcp_iam_role/tasks/autogen.yml
Normal file
|
@ -0,0 +1,128 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that role was created
|
||||
gcp_iam_role_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a role that already exists
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that role was deleted
|
||||
gcp_iam_role_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a role that does not exist
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,128 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that role was created
|
||||
gcp_iam_role_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a role that already exists
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a role
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that role was deleted
|
||||
gcp_iam_role_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*myCustomRole2.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a role that does not exist
|
||||
gcp_iam_role:
|
||||
name: myCustomRole2
|
||||
title: My Custom Role
|
||||
description: My custom role description
|
||||
included_permissions:
|
||||
- iam.roles.list
|
||||
- iam.roles.create
|
||||
- iam.roles.delete
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that service_account was created
|
||||
gcp_iam_service_account_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a service account that already exists
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that service_account was deleted
|
||||
gcp_iam_service_account_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a service account that does not exist
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,103 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that service_account was created
|
||||
gcp_iam_service_account_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a service account that already exists
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a service account
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that service_account was deleted
|
||||
gcp_iam_service_account_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/iam
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a service account that does not exist
|
||||
gcp_iam_service_account:
|
||||
name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com
|
||||
display_name: My Ansible test key
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
# Copyright 2019 Google Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
---
|
||||
# Pre-test setup
|
||||
- name: create a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: key-key-ring
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: keyring
|
||||
- name: delete a crypto key
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a crypto key
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that crypto_key was created
|
||||
gcp_kms_crypto_key_info:
|
||||
key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloudkms
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a crypto key that already exists
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,73 +1,2 @@
|
|||
# Copyright 2019 Google Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
---
|
||||
# Pre-test setup
|
||||
- name: create a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: key-key-ring
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: keyring
|
||||
- name: delete a crypto key
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a crypto key
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that crypto_key was created
|
||||
gcp_kms_crypto_key_info:
|
||||
key_ring: "projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloudkms
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a crypto key that already exists
|
||||
gcp_kms_crypto_key:
|
||||
name: "{{ resource_name }}"
|
||||
key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
63
tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml
Normal file
63
tests/integration/targets/gcp_kms_key_ring/tasks/autogen.yml
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Copyright 2019 Google Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Pre-test setup
|
||||
- name: delete a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that key_ring was created
|
||||
gcp_kms_key_ring_info:
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloudkms
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a key ring that already exists
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,63 +1,2 @@
|
|||
# Copyright 2019 Google Inc.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Pre-test setup
|
||||
- name: delete a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a key ring
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that key_ring was created
|
||||
gcp_kms_key_ring_info:
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloudkms
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a key ring that already exists
|
||||
gcp_kms_key_ring:
|
||||
name: "{{ resource_name }}"
|
||||
location: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
---
|
||||
- include_tasks: autogen.yml
|
||||
|
|
113
tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml
Normal file
113
tests/integration/targets/gcp_mlengine_model/tasks/autogen.yml
Normal file
|
@ -0,0 +1,113 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that model was created
|
||||
gcp_mlengine_model_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a model that already exists
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that model was deleted
|
||||
gcp_mlengine_model_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a model that does not exist
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
|
@ -1,113 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that model was created
|
||||
gcp_mlengine_model_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a model that already exists
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that model was deleted
|
||||
gcp_mlengine_model_info:
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a model that does not exist
|
||||
gcp_mlengine_model:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
- include_tasks: autogen.yml
|
||||
|
|
155
tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml
Normal file
155
tests/integration/targets/gcp_mlengine_version/tasks/autogen.yml
Normal file
|
@ -0,0 +1,155 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a model
|
||||
gcp_mlengine_model:
|
||||
name: model_version
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
online_prediction_logging: 'true'
|
||||
online_prediction_console_logging: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: model
|
||||
- name: delete a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that version was created
|
||||
gcp_mlengine_version_info:
|
||||
model: "{{ model }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a version that already exists
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that version was deleted
|
||||
gcp_mlengine_version_info:
|
||||
model: "{{ model }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a version that does not exist
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: model_version
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
online_prediction_logging: 'true'
|
||||
online_prediction_console_logging: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: model
|
||||
ignore_errors: true
|
|
@ -1,155 +1,2 @@
|
|||
---
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
#
|
||||
# This file is automatically generated by Magic Modules and manual
|
||||
# changes will be clobbered when the file is regenerated.
|
||||
#
|
||||
# Please read more about how to change this file at
|
||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
# Pre-test setup
|
||||
- name: create a model
|
||||
gcp_mlengine_model:
|
||||
name: model_version
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
online_prediction_logging: 'true'
|
||||
online_prediction_console_logging: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: model
|
||||
- name: delete a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
#----------------------------------------------------------
|
||||
- name: create a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that version was created
|
||||
gcp_mlengine_version_info:
|
||||
model: "{{ model }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 1
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: create a version that already exists
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#----------------------------------------------------------
|
||||
- name: delete a version
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is true
|
||||
assert:
|
||||
that:
|
||||
- result.changed == true
|
||||
- name: verify that version was deleted
|
||||
gcp_mlengine_version_info:
|
||||
model: "{{ model }}"
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
scopes:
|
||||
- https://www.googleapis.com/auth/cloud-platform
|
||||
register: results
|
||||
- name: verify that command succeeded
|
||||
assert:
|
||||
that:
|
||||
- results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name | replace('-', '_') }}.*") | list | length == 0
|
||||
# ----------------------------------------------------------------------------
|
||||
- name: delete a version that does not exist
|
||||
gcp_mlengine_version:
|
||||
name: "{{ resource_name | replace('-', '_') }}"
|
||||
model: "{{ model }}"
|
||||
runtime_version: 1.13
|
||||
python_version: 3.5
|
||||
is_default: 'true'
|
||||
deployment_uri: gs://ansible-cloudml-bucket/
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: assert changed is false
|
||||
assert:
|
||||
that:
|
||||
- result.changed == false
|
||||
#---------------------------------------------------------
|
||||
# Post-test teardown
|
||||
# If errors happen, don't crash the playbook!
|
||||
- name: delete a model
|
||||
gcp_mlengine_model:
|
||||
name: model_version
|
||||
description: My model
|
||||
regions:
|
||||
- us-central1
|
||||
online_prediction_logging: 'true'
|
||||
online_prediction_console_logging: 'true'
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: absent
|
||||
register: model
|
||||
ignore_errors: true
|
||||
- include_tasks: autogen.yml
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue