mirror of https://github.com/ansible/ansible.git
Bug fixes for GCP modules (#61916)
parent
b4d15b3040
commit
53cd75bee6
@ -0,0 +1,206 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: address
|
||||||
|
- name: delete a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_template was created
|
||||||
|
gcp_compute_instance_template_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance template that already exists
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_template was deleted
|
||||||
|
gcp_compute_instance_template_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance template that does not exist
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: address
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,206 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancetemplate
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: create a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instancetemplate
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: address
|
|
||||||
- name: delete a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_template was created
|
|
||||||
gcp_compute_instance_template_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance template that already exists
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_template was deleted
|
|
||||||
gcp_compute_instance_template_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance template that does not exist
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instancetemplate
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: address
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancetemplate
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that network was created
|
||||||
|
gcp_compute_network_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a network that already exists
|
||||||
|
gcp_compute_network:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that network was deleted
|
||||||
|
gcp_compute_network_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a network that does not exist
|
||||||
|
gcp_compute_network:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,107 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that network was created
|
|
||||||
gcp_compute_network_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a network that already exists
|
|
||||||
gcp_compute_network:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that network was deleted
|
|
||||||
gcp_compute_network_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a network that does not exist
|
|
||||||
gcp_compute_network:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,139 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a region disk
|
||||||
|
gcp_compute_region_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 500
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
region: us-central1
|
||||||
|
replica_zones:
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a region disk
|
||||||
|
gcp_compute_region_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 500
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
region: us-central1
|
||||||
|
replica_zones:
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that region_disk was created
|
||||||
|
gcp_compute_region_disk_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a region disk that already exists
|
||||||
|
gcp_compute_region_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 500
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
region: us-central1
|
||||||
|
replica_zones:
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a region disk
|
||||||
|
gcp_compute_region_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 500
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
region: us-central1
|
||||||
|
replica_zones:
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that region_disk was deleted
|
||||||
|
gcp_compute_region_disk_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a region disk that does not exist
|
||||||
|
gcp_compute_region_disk:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
size_gb: 500
|
||||||
|
disk_encryption_key:
|
||||||
|
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
||||||
|
region: us-central1
|
||||||
|
replica_zones:
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
||||||
|
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,139 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: delete a region disk
|
|
||||||
gcp_compute_region_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 500
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
region: us-central1
|
|
||||||
replica_zones:
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a region disk
|
|
||||||
gcp_compute_region_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 500
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
region: us-central1
|
|
||||||
replica_zones:
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that region_disk was created
|
|
||||||
gcp_compute_region_disk_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a region disk that already exists
|
|
||||||
gcp_compute_region_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 500
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
region: us-central1
|
|
||||||
replica_zones:
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a region disk
|
|
||||||
gcp_compute_region_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 500
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
region: us-central1
|
|
||||||
replica_zones:
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that region_disk was deleted
|
|
||||||
gcp_compute_region_disk_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a region disk that does not exist
|
|
||||||
gcp_compute_region_disk:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
size_gb: 500
|
|
||||||
disk_encryption_key:
|
|
||||||
raw_key: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=
|
|
||||||
region: us-central1
|
|
||||||
replica_zones:
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-a
|
|
||||||
- https://www.googleapis.com/compute/v1/projects/google.com:graphite-playground/zones/us-central1-b
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,152 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-route
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: delete a route
|
||||||
|
gcp_compute_route:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
dest_range: 192.168.6.0/24
|
||||||
|
next_hop_gateway: global/gateways/default-internet-gateway
|
||||||
|
network: "{{ network }}"
|
||||||
|
tags:
|
||||||
|
- backends
|
||||||
|
- databases
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a route
|
||||||
|
gcp_compute_route:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
dest_range: 192.168.6.0/24
|
||||||
|
next_hop_gateway: global/gateways/default-internet-gateway
|
||||||
|
network: "{{ network }}"
|
||||||
|
tags:
|
||||||
|
- backends
|
||||||
|
- databases
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that route was created
|
||||||
|
gcp_compute_route_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a route that already exists
|
||||||
|
gcp_compute_route:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
dest_range: 192.168.6.0/24
|
||||||
|
next_hop_gateway: global/gateways/default-internet-gateway
|
||||||
|
network: "{{ network }}"
|
||||||
|
tags:
|
||||||
|
- backends
|
||||||
|
- databases
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a route
|
||||||
|
gcp_compute_route:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
dest_range: 192.168.6.0/24
|
||||||
|
next_hop_gateway: global/gateways/default-internet-gateway
|
||||||
|
network: "{{ network }}"
|
||||||
|
tags:
|
||||||
|
- backends
|
||||||
|
- databases
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that route was deleted
|
||||||
|
gcp_compute_route_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a route that does not exist
|
||||||
|
gcp_compute_route:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
dest_range: 192.168.6.0/24
|
||||||
|
next_hop_gateway: global/gateways/default-internet-gateway
|
||||||
|
network: "{{ network }}"
|
||||||
|
tags:
|
||||||
|
- backends
|
||||||
|
- databases
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-route
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,152 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-route
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: delete a route
|
|
||||||
gcp_compute_route:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
dest_range: 192.168.6.0/24
|
|
||||||
next_hop_gateway: global/gateways/default-internet-gateway
|
|
||||||
network: "{{ network }}"
|
|
||||||
tags:
|
|
||||||
- backends
|
|
||||||
- databases
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a route
|
|
||||||
gcp_compute_route:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
dest_range: 192.168.6.0/24
|
|
||||||
next_hop_gateway: global/gateways/default-internet-gateway
|
|
||||||
network: "{{ network }}"
|
|
||||||
tags:
|
|
||||||
- backends
|
|
||||||
- databases
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that route was created
|
|
||||||
gcp_compute_route_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a route that already exists
|
|
||||||
gcp_compute_route:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
dest_range: 192.168.6.0/24
|
|
||||||
next_hop_gateway: global/gateways/default-internet-gateway
|
|
||||||
network: "{{ network }}"
|
|
||||||
tags:
|
|
||||||
- backends
|
|
||||||
- databases
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a route
|
|
||||||
gcp_compute_route:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
dest_range: 192.168.6.0/24
|
|
||||||
next_hop_gateway: global/gateways/default-internet-gateway
|
|
||||||
network: "{{ network }}"
|
|
||||||
tags:
|
|
||||||
- backends
|
|
||||||
- databases
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that route was deleted
|
|
||||||
gcp_compute_route_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a route that does not exist
|
|
||||||
gcp_compute_route:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
dest_range: 192.168.6.0/24
|
|
||||||
next_hop_gateway: global/gateways/default-internet-gateway
|
|
||||||
network: "{{ network }}"
|
|
||||||
tags:
|
|
||||||
- backends
|
|
||||||
- databases
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-route
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,174 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-router
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: delete a router
|
||||||
|
gcp_compute_router:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
network: "{{ network }}"
|
||||||
|
bgp:
|
||||||
|
asn: 64514
|
||||||
|
advertise_mode: CUSTOM
|
||||||
|
advertised_groups:
|
||||||
|
- ALL_SUBNETS
|
||||||
|
advertised_ip_ranges:
|
||||||
|
- range: 1.2.3.4
|
||||||
|
- range: 6.7.0.0/16
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a router
|
||||||
|
gcp_compute_router:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
network: "{{ network }}"
|
||||||
|
bgp:
|
||||||
|
asn: 64514
|
||||||
|
advertise_mode: CUSTOM
|
||||||
|
advertised_groups:
|
||||||
|
- ALL_SUBNETS
|
||||||
|
advertised_ip_ranges:
|
||||||
|
- range: 1.2.3.4
|
||||||
|
- range: 6.7.0.0/16
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that router was created
|
||||||
|
gcp_compute_router_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a router that already exists
|
||||||
|
gcp_compute_router:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
network: "{{ network }}"
|
||||||
|
bgp:
|
||||||
|
asn: 64514
|
||||||
|
advertise_mode: CUSTOM
|
||||||
|
advertised_groups:
|
||||||
|
- ALL_SUBNETS
|
||||||
|
advertised_ip_ranges:
|
||||||
|
- range: 1.2.3.4
|
||||||
|
- range: 6.7.0.0/16
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a router
|
||||||
|
gcp_compute_router:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
network: "{{ network }}"
|
||||||
|
bgp:
|
||||||
|
asn: 64514
|
||||||
|
advertise_mode: CUSTOM
|
||||||
|
advertised_groups:
|
||||||
|
- ALL_SUBNETS
|
||||||
|
advertised_ip_ranges:
|
||||||
|
- range: 1.2.3.4
|
||||||
|
- range: 6.7.0.0/16
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that router was deleted
|
||||||
|
gcp_compute_router_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a router that does not exist
|
||||||
|
gcp_compute_router:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
network: "{{ network }}"
|
||||||
|
bgp:
|
||||||
|
asn: 64514
|
||||||
|
advertise_mode: CUSTOM
|
||||||
|
advertised_groups:
|
||||||
|
- ALL_SUBNETS
|
||||||
|
advertised_ip_ranges:
|
||||||
|
- range: 1.2.3.4
|
||||||
|
- range: 6.7.0.0/16
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-router
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,174 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-router
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: delete a router
|
|
||||||
gcp_compute_router:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
network: "{{ network }}"
|
|
||||||
bgp:
|
|
||||||
asn: 64514
|
|
||||||
advertise_mode: CUSTOM
|
|
||||||
advertised_groups:
|
|
||||||
- ALL_SUBNETS
|
|
||||||
advertised_ip_ranges:
|
|
||||||
- range: 1.2.3.4
|
|
||||||
- range: 6.7.0.0/16
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a router
|
|
||||||
gcp_compute_router:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
network: "{{ network }}"
|
|
||||||
bgp:
|
|
||||||
asn: 64514
|
|
||||||
advertise_mode: CUSTOM
|
|
||||||
advertised_groups:
|
|
||||||
- ALL_SUBNETS
|
|
||||||
advertised_ip_ranges:
|
|
||||||
- range: 1.2.3.4
|
|
||||||
- range: 6.7.0.0/16
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that router was created
|
|
||||||
gcp_compute_router_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a router that already exists
|
|
||||||
gcp_compute_router:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
network: "{{ network }}"
|
|
||||||
bgp:
|
|
||||||
asn: 64514
|
|
||||||
advertise_mode: CUSTOM
|
|
||||||
advertised_groups:
|
|
||||||
- ALL_SUBNETS
|
|
||||||
advertised_ip_ranges:
|
|
||||||
- range: 1.2.3.4
|
|
||||||
- range: 6.7.0.0/16
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a router
|
|
||||||
gcp_compute_router:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
network: "{{ network }}"
|
|
||||||
bgp:
|
|
||||||
asn: 64514
|
|
||||||
advertise_mode: CUSTOM
|
|
||||||
advertised_groups:
|
|
||||||
- ALL_SUBNETS
|
|
||||||
advertised_ip_ranges:
|
|
||||||
- range: 1.2.3.4
|
|
||||||
- range: 6.7.0.0/16
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that router was deleted
|
|
||||||
gcp_compute_router_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a router that does not exist
|
|
||||||
gcp_compute_router:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
network: "{{ network }}"
|
|
||||||
bgp:
|
|
||||||
asn: 64514
|
|
||||||
advertise_mode: CUSTOM
|
|
||||||
advertised_groups:
|
|
||||||
- ALL_SUBNETS
|
|
||||||
advertised_ip_ranges:
|
|
||||||
- range: 1.2.3.4
|
|
||||||
- range: 6.7.0.0/16
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-router
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,144 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-snapshot
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: disk
|
||||||
|
- name: delete a snapshot
|
||||||
|
gcp_compute_snapshot:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
labels:
|
||||||
|
my_label: value
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a snapshot
|
||||||
|
gcp_compute_snapshot:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
labels:
|
||||||
|
my_label: value
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that snapshot was created
|
||||||
|
gcp_compute_snapshot_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a snapshot that already exists
|
||||||
|
gcp_compute_snapshot:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
labels:
|
||||||
|
my_label: value
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a snapshot
|
||||||
|
gcp_compute_snapshot:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
labels:
|
||||||
|
my_label: value
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that snapshot was deleted
|
||||||
|
gcp_compute_snapshot_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a snapshot that does not exist
|
||||||
|
gcp_compute_snapshot:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
labels:
|
||||||
|
my_label: value
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-snapshot
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: disk
|
||||||
|
ignore_errors: true
|
@ -1,144 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: disk-snapshot
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: disk
|
|
||||||
- name: delete a snapshot
|
|
||||||
gcp_compute_snapshot:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
labels:
|
|
||||||
my_label: value
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a snapshot
|
|
||||||
gcp_compute_snapshot:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
labels:
|
|
||||||
my_label: value
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that snapshot was created
|
|
||||||
gcp_compute_snapshot_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a snapshot that already exists
|
|
||||||
gcp_compute_snapshot:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
labels:
|
|
||||||
my_label: value
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a snapshot
|
|
||||||
gcp_compute_snapshot:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
labels:
|
|
||||||
my_label: value
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that snapshot was deleted
|
|
||||||
gcp_compute_snapshot_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a snapshot that does not exist
|
|
||||||
gcp_compute_snapshot:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
labels:
|
|
||||||
my_label: value
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: disk-snapshot
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: disk
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,227 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a SSL certificate
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a SSL certificate
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that ssl_certificate was created
|
||||||
|
gcp_compute_ssl_certificate_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a SSL certificate that already exists
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a SSL certificate
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that ssl_certificate was deleted
|
||||||
|
gcp_compute_ssl_certificate_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a SSL certificate that does not exist
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,227 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: delete a SSL certificate
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a SSL certificate
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that ssl_certificate was created
|
|
||||||
gcp_compute_ssl_certificate_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a SSL certificate that already exists
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a SSL certificate
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that ssl_certificate was deleted
|
|
||||||
gcp_compute_ssl_certificate_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a SSL certificate that does not exist
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,127 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a SSL policy
|
||||||
|
gcp_compute_ssl_policy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
profile: CUSTOM
|
||||||
|
min_tls_version: TLS_1_2
|
||||||
|
custom_features:
|
||||||
|
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a SSL policy
|
||||||
|
gcp_compute_ssl_policy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
profile: CUSTOM
|
||||||
|
min_tls_version: TLS_1_2
|
||||||
|
custom_features:
|
||||||
|
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that ssl_policy was created
|
||||||
|
gcp_compute_ssl_policy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a SSL policy that already exists
|
||||||
|
gcp_compute_ssl_policy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
profile: CUSTOM
|
||||||
|
min_tls_version: TLS_1_2
|
||||||
|
custom_features:
|
||||||
|
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a SSL policy
|
||||||
|
gcp_compute_ssl_policy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
profile: CUSTOM
|
||||||
|
min_tls_version: TLS_1_2
|
||||||
|
custom_features:
|
||||||
|
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that ssl_policy was deleted
|
||||||
|
gcp_compute_ssl_policy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a SSL policy that does not exist
|
||||||
|
gcp_compute_ssl_policy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
profile: CUSTOM
|
||||||
|
min_tls_version: TLS_1_2
|
||||||
|
custom_features:
|
||||||
|
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,127 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: delete a SSL policy
|
|
||||||
gcp_compute_ssl_policy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
profile: CUSTOM
|
|
||||||
min_tls_version: TLS_1_2
|
|
||||||
custom_features:
|
|
||||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
|
||||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a SSL policy
|
|
||||||
gcp_compute_ssl_policy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
profile: CUSTOM
|
|
||||||
min_tls_version: TLS_1_2
|
|
||||||
custom_features:
|
|
||||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
|
||||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that ssl_policy was created
|
|
||||||
gcp_compute_ssl_policy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a SSL policy that already exists
|
|
||||||
gcp_compute_ssl_policy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
profile: CUSTOM
|
|
||||||
min_tls_version: TLS_1_2
|
|
||||||
custom_features:
|
|
||||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
|
||||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a SSL policy
|
|
||||||
gcp_compute_ssl_policy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
profile: CUSTOM
|
|
||||||
min_tls_version: TLS_1_2
|
|
||||||
custom_features:
|
|
||||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
|
||||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that ssl_policy was deleted
|
|
||||||
gcp_compute_ssl_policy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a SSL policy that does not exist
|
|
||||||
gcp_compute_ssl_policy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
profile: CUSTOM
|
|
||||||
min_tls_version: TLS_1_2
|
|
||||||
custom_features:
|
|
||||||
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
|
||||||
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,141 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-subnetwork
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: delete a subnetwork
|
||||||
|
gcp_compute_subnetwork:
|
||||||
|
name: ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
network: "{{ network }}"
|
||||||
|
ip_cidr_range: 172.16.0.0/16
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a subnetwork
|
||||||
|
gcp_compute_subnetwork:
|
||||||
|
name: ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
network: "{{ network }}"
|
||||||
|
ip_cidr_range: 172.16.0.0/16
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that subnetwork was created
|
||||||
|
gcp_compute_subnetwork_info:
|
||||||
|
filters:
|
||||||
|
- name = ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a subnetwork that already exists
|
||||||
|
gcp_compute_subnetwork:
|
||||||
|
name: ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
network: "{{ network }}"
|
||||||
|
ip_cidr_range: 172.16.0.0/16
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a subnetwork
|
||||||
|
gcp_compute_subnetwork:
|
||||||
|
name: ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
network: "{{ network }}"
|
||||||
|
ip_cidr_range: 172.16.0.0/16
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that subnetwork was deleted
|
||||||
|
gcp_compute_subnetwork_info:
|
||||||
|
filters:
|
||||||
|
- name = ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a subnetwork that does not exist
|
||||||
|
gcp_compute_subnetwork:
|
||||||
|
name: ansiblenet
|
||||||
|
region: us-west1
|
||||||
|
network: "{{ network }}"
|
||||||
|
ip_cidr_range: 172.16.0.0/16
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-subnetwork
|
||||||
|
auto_create_subnetworks: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,141 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-subnetwork
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: delete a subnetwork
|
|
||||||
gcp_compute_subnetwork:
|
|
||||||
name: ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
network: "{{ network }}"
|
|
||||||
ip_cidr_range: 172.16.0.0/16
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a subnetwork
|
|
||||||
gcp_compute_subnetwork:
|
|
||||||
name: ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
network: "{{ network }}"
|
|
||||||
ip_cidr_range: 172.16.0.0/16
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that subnetwork was created
|
|
||||||
gcp_compute_subnetwork_info:
|
|
||||||
filters:
|
|
||||||
- name = ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a subnetwork that already exists
|
|
||||||
gcp_compute_subnetwork:
|
|
||||||
name: ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
network: "{{ network }}"
|
|
||||||
ip_cidr_range: 172.16.0.0/16
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a subnetwork
|
|
||||||
gcp_compute_subnetwork:
|
|
||||||
name: ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
network: "{{ network }}"
|
|
||||||
ip_cidr_range: 172.16.0.0/16
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that subnetwork was deleted
|
|
||||||
gcp_compute_subnetwork_info:
|
|
||||||
filters:
|
|
||||||
- name = ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a subnetwork that does not exist
|
|
||||||
gcp_compute_subnetwork:
|
|
||||||
name: ansiblenet
|
|
||||||
region: us-west1
|
|
||||||
network: "{{ network }}"
|
|
||||||
ip_cidr_range: 172.16.0.0/16
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-subnetwork
|
|
||||||
auto_create_subnetworks: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,200 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-targethttpproxy
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancegroup
|
||||||
|
- name: create a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-targethttpproxy
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: healthcheck
|
||||||
|
- name: create a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-targethttpproxy
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: backendservice
|
||||||
|
- name: create a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-targethttpproxy
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: urlmap
|
||||||
|
- name: delete a target HTTP proxy
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a target HTTP proxy
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that target_http_proxy was created
|
||||||
|
gcp_compute_target_http_proxy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a target HTTP proxy that already exists
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a target HTTP proxy
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that target_http_proxy was deleted
|
||||||
|
gcp_compute_target_http_proxy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a target HTTP proxy that does not exist
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-targethttpproxy
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: urlmap
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-targethttpproxy
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: backendservice
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-targethttpproxy
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: healthcheck
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-targethttpproxy
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancegroup
|
||||||
|
ignore_errors: true
|
@ -1,200 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-targethttpproxy
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancegroup
|
|
||||||
- name: create a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-targethttpproxy
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: healthcheck
|
|
||||||
- name: create a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-targethttpproxy
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: backendservice
|
|
||||||
- name: create a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-targethttpproxy
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: urlmap
|
|
||||||
- name: delete a target HTTP proxy
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a target HTTP proxy
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that target_http_proxy was created
|
|
||||||
gcp_compute_target_http_proxy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a target HTTP proxy that already exists
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a target HTTP proxy
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that target_http_proxy was deleted
|
|
||||||
gcp_compute_target_http_proxy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a target HTTP proxy that does not exist
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-targethttpproxy
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: urlmap
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-targethttpproxy
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: backendservice
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-targethttpproxy
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: healthcheck
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-targethttpproxy
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancegroup
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,277 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-targethttpsproxy
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancegroup
|
||||||
|
- name: create a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-targethttpsproxy
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: healthcheck
|
||||||
|
- name: create a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-targethttpsproxy
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: backendservice
|
||||||
|
- name: create a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-targethttpsproxy
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: urlmap
|
||||||
|
- name: create a SSL certificate
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: sslcert-targethttpsproxy
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: sslcert
|
||||||
|
- name: delete a target HTTPS proxy
|
||||||
|
gcp_compute_target_https_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ssl_certificates:
|
||||||
|
- "{{ sslcert }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a target HTTPS proxy
|
||||||
|
gcp_compute_target_https_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ssl_certificates:
|
||||||
|
- "{{ sslcert }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that target_https_proxy was created
|
||||||
|
gcp_compute_target_https_proxy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a target HTTPS proxy that already exists
|
||||||
|
gcp_compute_target_https_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ssl_certificates:
|
||||||
|
- "{{ sslcert }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a target HTTPS proxy
|
||||||
|
gcp_compute_target_https_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ssl_certificates:
|
||||||
|
- "{{ sslcert }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that target_https_proxy was deleted
|
||||||
|
gcp_compute_target_https_proxy_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a target HTTPS proxy that does not exist
|
||||||
|
gcp_compute_target_https_proxy:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ssl_certificates:
|
||||||
|
- "{{ sslcert }}"
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a SSL certificate
|
||||||
|
gcp_compute_ssl_certificate:
|
||||||
|
name: sslcert-targethttpsproxy
|
||||||
|
description: A certificate for testing. Do not use this certificate in production
|
||||||
|
certificate: |-
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
||||||
|
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
||||||
|
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
||||||
|
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
||||||
|
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
||||||
|
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
||||||
|
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
||||||
|
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
||||||
|
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
||||||
|
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
||||||
|
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
||||||
|
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
||||||
|
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
||||||
|
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
||||||
|
zqGNhIPGq2ULqXKK8BY=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
|
private_key: |-
|
||||||
|
-----BEGIN EC PRIVATE KEY-----
|
||||||
|
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
||||||
|
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
||||||
|
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
||||||
|
-----END EC PRIVATE KEY-----
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: sslcert
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-targethttpsproxy
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: urlmap
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-targethttpsproxy
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: backendservice
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-targethttpsproxy
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: healthcheck
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-targethttpsproxy
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancegroup
|
||||||
|
ignore_errors: true
|
@ -1,277 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: create a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-targethttpsproxy
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancegroup
|
|
||||||
- name: create a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-targethttpsproxy
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: healthcheck
|
|
||||||
- name: create a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-targethttpsproxy
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: backendservice
|
|
||||||
- name: create a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-targethttpsproxy
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: urlmap
|
|
||||||
- name: create a SSL certificate
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: sslcert-targethttpsproxy
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: sslcert
|
|
||||||
- name: delete a target HTTPS proxy
|
|
||||||
gcp_compute_target_https_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ssl_certificates:
|
|
||||||
- "{{ sslcert }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a target HTTPS proxy
|
|
||||||
gcp_compute_target_https_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ssl_certificates:
|
|
||||||
- "{{ sslcert }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that target_https_proxy was created
|
|
||||||
gcp_compute_target_https_proxy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a target HTTPS proxy that already exists
|
|
||||||
gcp_compute_target_https_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ssl_certificates:
|
|
||||||
- "{{ sslcert }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a target HTTPS proxy
|
|
||||||
gcp_compute_target_https_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ssl_certificates:
|
|
||||||
- "{{ sslcert }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that target_https_proxy was deleted
|
|
||||||
gcp_compute_target_https_proxy_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a target HTTPS proxy that does not exist
|
|
||||||
gcp_compute_target_https_proxy:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ssl_certificates:
|
|
||||||
- "{{ sslcert }}"
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a SSL certificate
|
|
||||||
gcp_compute_ssl_certificate:
|
|
||||||
name: sslcert-targethttpsproxy
|
|
||||||
description: A certificate for testing. Do not use this certificate in production
|
|
||||||
certificate: |-
|
|
||||||
-----BEGIN CERTIFICATE-----
|
|
||||||
MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG
|
|
||||||
EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT
|
|
||||||
BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm
|
|
||||||
b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN
|
|
||||||
AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2
|
|
||||||
MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP
|
|
||||||
BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM
|
|
||||||
FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z
|
|
||||||
aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH
|
|
||||||
KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ
|
|
||||||
4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O
|
|
||||||
BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn
|
|
||||||
0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O
|
|
||||||
M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ
|
|
||||||
zqGNhIPGq2ULqXKK8BY=
|
|
||||||
-----END CERTIFICATE-----
|
|
||||||
private_key: |-
|
|
||||||
-----BEGIN EC PRIVATE KEY-----
|
|
||||||
MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49
|
|
||||||
AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f
|
|
||||||
OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ==
|
|
||||||
-----END EC PRIVATE KEY-----
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: sslcert
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-targethttpsproxy
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: urlmap
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-targethttpsproxy
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: backendservice
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-targethttpsproxy
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: healthcheck
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-targethttpsproxy
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancegroup
|
|
||||||
ignore_errors: true
|
|
||||||
|
Loading…
Reference in New Issue