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