mirror of https://github.com/ansible/ansible.git
Bug fixes for GCP modules (#61915)
parent
c2b8f64e83
commit
93f851b698
@ -0,0 +1,147 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a firewall
|
||||||
|
gcp_compute_firewall:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
allowed:
|
||||||
|
- ip_protocol: tcp
|
||||||
|
ports:
|
||||||
|
- '22'
|
||||||
|
target_tags:
|
||||||
|
- test-ssh-server
|
||||||
|
- staging-ssh-server
|
||||||
|
source_tags:
|
||||||
|
- test-ssh-clients
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a firewall
|
||||||
|
gcp_compute_firewall:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
allowed:
|
||||||
|
- ip_protocol: tcp
|
||||||
|
ports:
|
||||||
|
- '22'
|
||||||
|
target_tags:
|
||||||
|
- test-ssh-server
|
||||||
|
- staging-ssh-server
|
||||||
|
source_tags:
|
||||||
|
- test-ssh-clients
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that firewall was created
|
||||||
|
gcp_compute_firewall_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a firewall that already exists
|
||||||
|
gcp_compute_firewall:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
allowed:
|
||||||
|
- ip_protocol: tcp
|
||||||
|
ports:
|
||||||
|
- '22'
|
||||||
|
target_tags:
|
||||||
|
- test-ssh-server
|
||||||
|
- staging-ssh-server
|
||||||
|
source_tags:
|
||||||
|
- test-ssh-clients
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a firewall
|
||||||
|
gcp_compute_firewall:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
allowed:
|
||||||
|
- ip_protocol: tcp
|
||||||
|
ports:
|
||||||
|
- '22'
|
||||||
|
target_tags:
|
||||||
|
- test-ssh-server
|
||||||
|
- staging-ssh-server
|
||||||
|
source_tags:
|
||||||
|
- test-ssh-clients
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that firewall was deleted
|
||||||
|
gcp_compute_firewall_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a firewall that does not exist
|
||||||
|
gcp_compute_firewall:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
allowed:
|
||||||
|
- ip_protocol: tcp
|
||||||
|
ports:
|
||||||
|
- '22'
|
||||||
|
target_tags:
|
||||||
|
- test-ssh-server
|
||||||
|
- staging-ssh-server
|
||||||
|
source_tags:
|
||||||
|
- test-ssh-clients
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,147 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- include_tasks: autogen.yml
|
||||||
#
|
|
||||||
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
# This file is automatically generated by Magic Modules and manual
|
|
||||||
# changes will be clobbered when the file is regenerated.
|
|
||||||
#
|
|
||||||
# Please read more about how to change this file at
|
|
||||||
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
|
||||||
#
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Pre-test setup
|
|
||||||
- name: delete a firewall
|
|
||||||
gcp_compute_firewall:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
allowed:
|
|
||||||
- ip_protocol: tcp
|
|
||||||
ports:
|
|
||||||
- '22'
|
|
||||||
target_tags:
|
|
||||||
- test-ssh-server
|
|
||||||
- staging-ssh-server
|
|
||||||
source_tags:
|
|
||||||
- test-ssh-clients
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a firewall
|
|
||||||
gcp_compute_firewall:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
allowed:
|
|
||||||
- ip_protocol: tcp
|
|
||||||
ports:
|
|
||||||
- '22'
|
|
||||||
target_tags:
|
|
||||||
- test-ssh-server
|
|
||||||
- staging-ssh-server
|
|
||||||
source_tags:
|
|
||||||
- test-ssh-clients
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that firewall was created
|
|
||||||
gcp_compute_firewall_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a firewall that already exists
|
|
||||||
gcp_compute_firewall:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
allowed:
|
|
||||||
- ip_protocol: tcp
|
|
||||||
ports:
|
|
||||||
- '22'
|
|
||||||
target_tags:
|
|
||||||
- test-ssh-server
|
|
||||||
- staging-ssh-server
|
|
||||||
source_tags:
|
|
||||||
- test-ssh-clients
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a firewall
|
|
||||||
gcp_compute_firewall:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
allowed:
|
|
||||||
- ip_protocol: tcp
|
|
||||||
ports:
|
|
||||||
- '22'
|
|
||||||
target_tags:
|
|
||||||
- test-ssh-server
|
|
||||||
- staging-ssh-server
|
|
||||||
source_tags:
|
|
||||||
- test-ssh-clients
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that firewall was deleted
|
|
||||||
gcp_compute_firewall_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a firewall that does not exist
|
|
||||||
gcp_compute_firewall:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
allowed:
|
|
||||||
- ip_protocol: tcp
|
|
||||||
ports:
|
|
||||||
- '22'
|
|
||||||
target_tags:
|
|
||||||
- test-ssh-server
|
|
||||||
- staging-ssh-server
|
|
||||||
source_tags:
|
|
||||||
- test-ssh-clients
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,170 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-forwardingrule
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: address
|
||||||
|
- name: create a target pool
|
||||||
|
gcp_compute_target_pool:
|
||||||
|
name: targetpool-forwardingrule
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: targetpool
|
||||||
|
- name: delete a forwarding rule
|
||||||
|
gcp_compute_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
region: us-west1
|
||||||
|
target: "{{ targetpool }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
ip_address: "{{ address.address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a forwarding rule
|
||||||
|
gcp_compute_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
region: us-west1
|
||||||
|
target: "{{ targetpool }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
ip_address: "{{ address.address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that forwarding_rule was created
|
||||||
|
gcp_compute_forwarding_rule_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a forwarding rule that already exists
|
||||||
|
gcp_compute_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
region: us-west1
|
||||||
|
target: "{{ targetpool }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
ip_address: "{{ address.address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a forwarding rule
|
||||||
|
gcp_compute_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
region: us-west1
|
||||||
|
target: "{{ targetpool }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
ip_address: "{{ address.address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that forwarding_rule was deleted
|
||||||
|
gcp_compute_forwarding_rule_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a forwarding rule that does not exist
|
||||||
|
gcp_compute_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
region: us-west1
|
||||||
|
target: "{{ targetpool }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
ip_address: "{{ address.address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a target pool
|
||||||
|
gcp_compute_target_pool:
|
||||||
|
name: targetpool-forwardingrule
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: targetpool
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-forwardingrule
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: address
|
||||||
|
ignore_errors: true
|
@ -1,170 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-forwardingrule
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: address
|
|
||||||
- name: create a target pool
|
|
||||||
gcp_compute_target_pool:
|
|
||||||
name: targetpool-forwardingrule
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: targetpool
|
|
||||||
- name: delete a forwarding rule
|
|
||||||
gcp_compute_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
region: us-west1
|
|
||||||
target: "{{ targetpool }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
ip_address: "{{ address.address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a forwarding rule
|
|
||||||
gcp_compute_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
region: us-west1
|
|
||||||
target: "{{ targetpool }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
ip_address: "{{ address.address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that forwarding_rule was created
|
|
||||||
gcp_compute_forwarding_rule_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a forwarding rule that already exists
|
|
||||||
gcp_compute_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
region: us-west1
|
|
||||||
target: "{{ targetpool }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
ip_address: "{{ address.address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a forwarding rule
|
|
||||||
gcp_compute_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
region: us-west1
|
|
||||||
target: "{{ targetpool }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
ip_address: "{{ address.address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that forwarding_rule was deleted
|
|
||||||
gcp_compute_forwarding_rule_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a forwarding rule that does not exist
|
|
||||||
gcp_compute_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
region: us-west1
|
|
||||||
target: "{{ targetpool }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
ip_address: "{{ address.address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a target pool
|
|
||||||
gcp_compute_target_pool:
|
|
||||||
name: targetpool-forwardingrule
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: targetpool
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-forwardingrule
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: address
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a global address
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a global address
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that global_address was created
|
||||||
|
gcp_compute_global_address_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a global address that already exists
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a global address
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that global_address was deleted
|
||||||
|
gcp_compute_global_address_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a global address that does not exist
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,102 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 global address
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a global address
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that global_address was created
|
|
||||||
gcp_compute_global_address_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a global address that already exists
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a global address
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that global_address was deleted
|
|
||||||
gcp_compute_global_address_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a global address that does not exist
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,251 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a global address
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: globaladdress-globalforwardingrule
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: globaladdress
|
||||||
|
- name: create a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-globalforwardingrule
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancegroup
|
||||||
|
- name: create a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-globalforwardingrule
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: healthcheck
|
||||||
|
- name: create a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-globalforwardingrule
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: backendservice
|
||||||
|
- name: create a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-globalforwardingrule
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: urlmap
|
||||||
|
- name: create a target HTTP proxy
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: targethttpproxy-globalforwardingrule
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: httpproxy
|
||||||
|
- name: delete a global forwarding rule
|
||||||
|
gcp_compute_global_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ip_address: "{{ globaladdress.address }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
target: "{{ httpproxy.selfLink }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a global forwarding rule
|
||||||
|
gcp_compute_global_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ip_address: "{{ globaladdress.address }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
target: "{{ httpproxy.selfLink }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that global_forwarding_rule was created
|
||||||
|
gcp_compute_global_forwarding_rule_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a global forwarding rule that already exists
|
||||||
|
gcp_compute_global_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ip_address: "{{ globaladdress.address }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
target: "{{ httpproxy.selfLink }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a global forwarding rule
|
||||||
|
gcp_compute_global_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ip_address: "{{ globaladdress.address }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
target: "{{ httpproxy.selfLink }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that global_forwarding_rule was deleted
|
||||||
|
gcp_compute_global_forwarding_rule_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a global forwarding rule that does not exist
|
||||||
|
gcp_compute_global_forwarding_rule:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
ip_address: "{{ globaladdress.address }}"
|
||||||
|
ip_protocol: TCP
|
||||||
|
port_range: 80-80
|
||||||
|
target: "{{ httpproxy.selfLink }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a target HTTP proxy
|
||||||
|
gcp_compute_target_http_proxy:
|
||||||
|
name: targethttpproxy-globalforwardingrule
|
||||||
|
url_map: "{{ urlmap }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: httpproxy
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a URL map
|
||||||
|
gcp_compute_url_map:
|
||||||
|
name: urlmap-globalforwardingrule
|
||||||
|
default_service: "{{ backendservice }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: urlmap
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a backend service
|
||||||
|
gcp_compute_backend_service:
|
||||||
|
name: backendservice-globalforwardingrule
|
||||||
|
backends:
|
||||||
|
- group: "{{ instancegroup.selfLink }}"
|
||||||
|
health_checks:
|
||||||
|
- "{{ healthcheck.selfLink }}"
|
||||||
|
enable_cdn: 'true'
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: backendservice
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: httphealthcheck-globalforwardingrule
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: healthcheck
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: instancegroup-globalforwardingrule
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancegroup
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a global address
|
||||||
|
gcp_compute_global_address:
|
||||||
|
name: globaladdress-globalforwardingrule
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: globaladdress
|
||||||
|
ignore_errors: true
|
@ -1,251 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 global address
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: globaladdress-globalforwardingrule
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: globaladdress
|
|
||||||
- name: create a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-globalforwardingrule
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancegroup
|
|
||||||
- name: create a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-globalforwardingrule
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: healthcheck
|
|
||||||
- name: create a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-globalforwardingrule
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: backendservice
|
|
||||||
- name: create a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-globalforwardingrule
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: urlmap
|
|
||||||
- name: create a target HTTP proxy
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: targethttpproxy-globalforwardingrule
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: httpproxy
|
|
||||||
- name: delete a global forwarding rule
|
|
||||||
gcp_compute_global_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ip_address: "{{ globaladdress.address }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
target: "{{ httpproxy.selfLink }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a global forwarding rule
|
|
||||||
gcp_compute_global_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ip_address: "{{ globaladdress.address }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
target: "{{ httpproxy.selfLink }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that global_forwarding_rule was created
|
|
||||||
gcp_compute_global_forwarding_rule_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a global forwarding rule that already exists
|
|
||||||
gcp_compute_global_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ip_address: "{{ globaladdress.address }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
target: "{{ httpproxy.selfLink }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a global forwarding rule
|
|
||||||
gcp_compute_global_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ip_address: "{{ globaladdress.address }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
target: "{{ httpproxy.selfLink }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that global_forwarding_rule was deleted
|
|
||||||
gcp_compute_global_forwarding_rule_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a global forwarding rule that does not exist
|
|
||||||
gcp_compute_global_forwarding_rule:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
ip_address: "{{ globaladdress.address }}"
|
|
||||||
ip_protocol: TCP
|
|
||||||
port_range: 80-80
|
|
||||||
target: "{{ httpproxy.selfLink }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a target HTTP proxy
|
|
||||||
gcp_compute_target_http_proxy:
|
|
||||||
name: targethttpproxy-globalforwardingrule
|
|
||||||
url_map: "{{ urlmap }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: httpproxy
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a URL map
|
|
||||||
gcp_compute_url_map:
|
|
||||||
name: urlmap-globalforwardingrule
|
|
||||||
default_service: "{{ backendservice }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: urlmap
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a backend service
|
|
||||||
gcp_compute_backend_service:
|
|
||||||
name: backendservice-globalforwardingrule
|
|
||||||
backends:
|
|
||||||
- group: "{{ instancegroup.selfLink }}"
|
|
||||||
health_checks:
|
|
||||||
- "{{ healthcheck.selfLink }}"
|
|
||||||
enable_cdn: 'true'
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: backendservice
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: httphealthcheck-globalforwardingrule
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: healthcheck
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: instancegroup-globalforwardingrule
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancegroup
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a global address
|
|
||||||
gcp_compute_global_address:
|
|
||||||
name: globaladdress-globalforwardingrule
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: globaladdress
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,142 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a health check
|
||||||
|
gcp_compute_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
type: TCP
|
||||||
|
tcp_health_check:
|
||||||
|
port_name: service-health
|
||||||
|
request: ping
|
||||||
|
response: pong
|
||||||
|
healthy_threshold: 10
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a health check
|
||||||
|
gcp_compute_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
type: TCP
|
||||||
|
tcp_health_check:
|
||||||
|
port_name: service-health
|
||||||
|
request: ping
|
||||||
|
response: pong
|
||||||
|
healthy_threshold: 10
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that health_check was created
|
||||||
|
gcp_compute_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a health check that already exists
|
||||||
|
gcp_compute_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
type: TCP
|
||||||
|
tcp_health_check:
|
||||||
|
port_name: service-health
|
||||||
|
request: ping
|
||||||
|
response: pong
|
||||||
|
healthy_threshold: 10
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a health check
|
||||||
|
gcp_compute_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
type: TCP
|
||||||
|
tcp_health_check:
|
||||||
|
port_name: service-health
|
||||||
|
request: ping
|
||||||
|
response: pong
|
||||||
|
healthy_threshold: 10
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that health_check was deleted
|
||||||
|
gcp_compute_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a health check that does not exist
|
||||||
|
gcp_compute_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
type: TCP
|
||||||
|
tcp_health_check:
|
||||||
|
port_name: service-health
|
||||||
|
request: ping
|
||||||
|
response: pong
|
||||||
|
healthy_threshold: 10
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,142 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 health check
|
|
||||||
gcp_compute_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
type: TCP
|
|
||||||
tcp_health_check:
|
|
||||||
port_name: service-health
|
|
||||||
request: ping
|
|
||||||
response: pong
|
|
||||||
healthy_threshold: 10
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a health check
|
|
||||||
gcp_compute_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
type: TCP
|
|
||||||
tcp_health_check:
|
|
||||||
port_name: service-health
|
|
||||||
request: ping
|
|
||||||
response: pong
|
|
||||||
healthy_threshold: 10
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that health_check was created
|
|
||||||
gcp_compute_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a health check that already exists
|
|
||||||
gcp_compute_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
type: TCP
|
|
||||||
tcp_health_check:
|
|
||||||
port_name: service-health
|
|
||||||
request: ping
|
|
||||||
response: pong
|
|
||||||
healthy_threshold: 10
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a health check
|
|
||||||
gcp_compute_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
type: TCP
|
|
||||||
tcp_health_check:
|
|
||||||
port_name: service-health
|
|
||||||
request: ping
|
|
||||||
response: pong
|
|
||||||
healthy_threshold: 10
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that health_check was deleted
|
|
||||||
gcp_compute_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a health check that does not exist
|
|
||||||
gcp_compute_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
type: TCP
|
|
||||||
tcp_health_check:
|
|
||||||
port_name: service-health
|
|
||||||
request: ping
|
|
||||||
response: pong
|
|
||||||
healthy_threshold: 10
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that http_health_check was created
|
||||||
|
gcp_compute_http_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a HTTP health check that already exists
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a HTTP health check
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that http_health_check was deleted
|
||||||
|
gcp_compute_http_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a HTTP health check that does not exist
|
||||||
|
gcp_compute_http_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,122 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that http_health_check was created
|
|
||||||
gcp_compute_http_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a HTTP health check that already exists
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a HTTP health check
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that http_health_check was deleted
|
|
||||||
gcp_compute_http_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a HTTP health check that does not exist
|
|
||||||
gcp_compute_http_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: delete a HTTPS health check
|
||||||
|
gcp_compute_https_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a HTTPS health check
|
||||||
|
gcp_compute_https_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that https_health_check was created
|
||||||
|
gcp_compute_https_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a HTTPS health check that already exists
|
||||||
|
gcp_compute_https_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a HTTPS health check
|
||||||
|
gcp_compute_https_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that https_health_check was deleted
|
||||||
|
gcp_compute_https_health_check_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a HTTPS health check that does not exist
|
||||||
|
gcp_compute_https_health_check:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
healthy_threshold: 10
|
||||||
|
port: 8080
|
||||||
|
timeout_sec: 2
|
||||||
|
unhealthy_threshold: 5
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
@ -1,122 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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 HTTPS health check
|
|
||||||
gcp_compute_https_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a HTTPS health check
|
|
||||||
gcp_compute_https_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that https_health_check was created
|
|
||||||
gcp_compute_https_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a HTTPS health check that already exists
|
|
||||||
gcp_compute_https_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a HTTPS health check
|
|
||||||
gcp_compute_https_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that https_health_check was deleted
|
|
||||||
gcp_compute_https_health_check_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a HTTPS health check that does not exist
|
|
||||||
gcp_compute_https_health_check:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
healthy_threshold: 10
|
|
||||||
port: 8080
|
|
||||||
timeout_sec: 2
|
|
||||||
unhealthy_threshold: 5
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
|
@ -0,0 +1,129 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-image
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: disk
|
||||||
|
- name: delete a image
|
||||||
|
gcp_compute_image:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a image
|
||||||
|
gcp_compute_image:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that image was created
|
||||||
|
gcp_compute_image_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a image that already exists
|
||||||
|
gcp_compute_image:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a image
|
||||||
|
gcp_compute_image:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that image was deleted
|
||||||
|
gcp_compute_image_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a image that does not exist
|
||||||
|
gcp_compute_image:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
source_disk: "{{ disk }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-image
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: disk
|
||||||
|
ignore_errors: true
|
@ -1,129 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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-image
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: disk
|
|
||||||
- name: delete a image
|
|
||||||
gcp_compute_image:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a image
|
|
||||||
gcp_compute_image:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that image was created
|
|
||||||
gcp_compute_image_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a image that already exists
|
|
||||||
gcp_compute_image:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a image
|
|
||||||
gcp_compute_image:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that image was deleted
|
|
||||||
gcp_compute_image_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a image that does not exist
|
|
||||||
gcp_compute_image:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
source_disk: "{{ disk }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: disk-image
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: disk
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,251 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-instance
|
||||||
|
size_gb: 50
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: disk
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instance
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instance
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: address
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_compute_instance:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
source: "{{ disk }}"
|
||||||
|
metadata:
|
||||||
|
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||||
|
cost-center: '12345'
|
||||||
|
labels:
|
||||||
|
environment: production
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: External NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance
|
||||||
|
gcp_compute_instance:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
source: "{{ disk }}"
|
||||||
|
metadata:
|
||||||
|
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||||
|
cost-center: '12345'
|
||||||
|
labels:
|
||||||
|
environment: production
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: External NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was created
|
||||||
|
gcp_compute_instance_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance that already exists
|
||||||
|
gcp_compute_instance:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
source: "{{ disk }}"
|
||||||
|
metadata:
|
||||||
|
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||||
|
cost-center: '12345'
|
||||||
|
labels:
|
||||||
|
environment: production
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: External NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance
|
||||||
|
gcp_compute_instance:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
source: "{{ disk }}"
|
||||||
|
metadata:
|
||||||
|
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||||
|
cost-center: '12345'
|
||||||
|
labels:
|
||||||
|
environment: production
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: External NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance was deleted
|
||||||
|
gcp_compute_instance_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance that does not exist
|
||||||
|
gcp_compute_instance:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
source: "{{ disk }}"
|
||||||
|
metadata:
|
||||||
|
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
||||||
|
cost-center: '12345'
|
||||||
|
labels:
|
||||||
|
environment: production
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: External NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instance
|
||||||
|
region: us-central1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: address
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instance
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a disk
|
||||||
|
gcp_compute_disk:
|
||||||
|
name: disk-instance
|
||||||
|
size_gb: 50
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: disk
|
||||||
|
ignore_errors: true
|
@ -1,251 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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-instance
|
|
||||||
size_gb: 50
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: disk
|
|
||||||
- name: create a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instance
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: create a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instance
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: address
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_compute_instance:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
source: "{{ disk }}"
|
|
||||||
metadata:
|
|
||||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
|
||||||
cost-center: '12345'
|
|
||||||
labels:
|
|
||||||
environment: production
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: External NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance
|
|
||||||
gcp_compute_instance:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
source: "{{ disk }}"
|
|
||||||
metadata:
|
|
||||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
|
||||||
cost-center: '12345'
|
|
||||||
labels:
|
|
||||||
environment: production
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: External NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was created
|
|
||||||
gcp_compute_instance_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance that already exists
|
|
||||||
gcp_compute_instance:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
source: "{{ disk }}"
|
|
||||||
metadata:
|
|
||||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
|
||||||
cost-center: '12345'
|
|
||||||
labels:
|
|
||||||
environment: production
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: External NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance
|
|
||||||
gcp_compute_instance:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
source: "{{ disk }}"
|
|
||||||
metadata:
|
|
||||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
|
||||||
cost-center: '12345'
|
|
||||||
labels:
|
|
||||||
environment: production
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: External NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance was deleted
|
|
||||||
gcp_compute_instance_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance that does not exist
|
|
||||||
gcp_compute_instance:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
source: "{{ disk }}"
|
|
||||||
metadata:
|
|
||||||
startup-script-url: gs:://graphite-playground/bootstrap.sh
|
|
||||||
cost-center: '12345'
|
|
||||||
labels:
|
|
||||||
environment: production
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: External NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instance
|
|
||||||
region: us-central1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: address
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instance
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a disk
|
|
||||||
gcp_compute_disk:
|
|
||||||
name: disk-instance
|
|
||||||
size_gb: 50
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: disk
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancegroup
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
named_ports:
|
||||||
|
- name: ansible
|
||||||
|
port: 1234
|
||||||
|
network: "{{ network }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
named_ports:
|
||||||
|
- name: ansible
|
||||||
|
port: 1234
|
||||||
|
network: "{{ network }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_group was created
|
||||||
|
gcp_compute_instance_group_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance group that already exists
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
named_ports:
|
||||||
|
- name: ansible
|
||||||
|
port: 1234
|
||||||
|
network: "{{ network }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance group
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
named_ports:
|
||||||
|
- name: ansible
|
||||||
|
port: 1234
|
||||||
|
network: "{{ network }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_group was deleted
|
||||||
|
gcp_compute_instance_group_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance group that does not exist
|
||||||
|
gcp_compute_instance_group:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
named_ports:
|
||||||
|
- name: ansible
|
||||||
|
port: 1234
|
||||||
|
network: "{{ network }}"
|
||||||
|
zone: us-central1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancegroup
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,149 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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-instancegroup
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: network
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
named_ports:
|
|
||||||
- name: ansible
|
|
||||||
port: 1234
|
|
||||||
network: "{{ network }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
named_ports:
|
|
||||||
- name: ansible
|
|
||||||
port: 1234
|
|
||||||
network: "{{ network }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_group was created
|
|
||||||
gcp_compute_instance_group_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance group that already exists
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
named_ports:
|
|
||||||
- name: ansible
|
|
||||||
port: 1234
|
|
||||||
network: "{{ network }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance group
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
named_ports:
|
|
||||||
- name: ansible
|
|
||||||
port: 1234
|
|
||||||
network: "{{ network }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_group was deleted
|
|
||||||
gcp_compute_instance_group_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance group that does not exist
|
|
||||||
gcp_compute_instance_group:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
named_ports:
|
|
||||||
- name: ansible
|
|
||||||
port: 1234
|
|
||||||
network: "{{ network }}"
|
|
||||||
zone: us-central1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancegroup
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
@ -0,0 +1,206 @@
|
|||||||
|
---
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# This file is automatically generated by Magic Modules and manual
|
||||||
|
# changes will be clobbered when the file is regenerated.
|
||||||
|
#
|
||||||
|
# Please read more about how to change this file at
|
||||||
|
# https://www.github.com/GoogleCloudPlatform/magic-modules
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Pre-test setup
|
||||||
|
- name: create a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: network
|
||||||
|
- name: create a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: address
|
||||||
|
- name: create a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: instancetemplate
|
||||||
|
- name: delete a instance group manager
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: create a instance group manager
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_group_manager was created
|
||||||
|
gcp_compute_instance_group_manager_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 1
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: create a instance group manager that already exists
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: present
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#----------------------------------------------------------
|
||||||
|
- name: delete a instance group manager
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is true
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == true
|
||||||
|
- name: verify that instance_group_manager was deleted
|
||||||
|
gcp_compute_instance_group_manager_info:
|
||||||
|
filters:
|
||||||
|
- name = {{ resource_name }}
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
scopes:
|
||||||
|
- https://www.googleapis.com/auth/compute
|
||||||
|
register: results
|
||||||
|
- name: verify that command succeeded
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- results['resources'] | length == 0
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
- name: delete a instance group manager that does not exist
|
||||||
|
gcp_compute_instance_group_manager:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
base_instance_name: test1-child
|
||||||
|
instance_template: "{{ instancetemplate }}"
|
||||||
|
target_size: 3
|
||||||
|
zone: us-west1-a
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: result
|
||||||
|
- name: assert changed is false
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- result.changed == false
|
||||||
|
#---------------------------------------------------------
|
||||||
|
# Post-test teardown
|
||||||
|
# If errors happen, don't crash the playbook!
|
||||||
|
- name: delete a instance template
|
||||||
|
gcp_compute_instance_template:
|
||||||
|
name: "{{ resource_name }}"
|
||||||
|
properties:
|
||||||
|
disks:
|
||||||
|
- auto_delete: 'true'
|
||||||
|
boot: 'true'
|
||||||
|
initialize_params:
|
||||||
|
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
||||||
|
machine_type: n1-standard-1
|
||||||
|
network_interfaces:
|
||||||
|
- network: "{{ network }}"
|
||||||
|
access_configs:
|
||||||
|
- name: test-config
|
||||||
|
type: ONE_TO_ONE_NAT
|
||||||
|
nat_ip: "{{ address }}"
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: instancetemplate
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a address
|
||||||
|
gcp_compute_address:
|
||||||
|
name: address-instancetemplate
|
||||||
|
region: us-west1
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: address
|
||||||
|
ignore_errors: true
|
||||||
|
- name: delete a network
|
||||||
|
gcp_compute_network:
|
||||||
|
name: network-instancetemplate
|
||||||
|
project: "{{ gcp_project }}"
|
||||||
|
auth_kind: "{{ gcp_cred_kind }}"
|
||||||
|
service_account_file: "{{ gcp_cred_file }}"
|
||||||
|
state: absent
|
||||||
|
register: network
|
||||||
|
ignore_errors: true
|
@ -1,206 +1,2 @@
|
|||||||
---
|
---
|
||||||
# ----------------------------------------------------------------------------
|
- 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: create a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: instancetemplate
|
|
||||||
- name: delete a instance group manager
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: create a instance group manager
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_group_manager was created
|
|
||||||
gcp_compute_instance_group_manager_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 1
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: create a instance group manager that already exists
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: present
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#----------------------------------------------------------
|
|
||||||
- name: delete a instance group manager
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is true
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == true
|
|
||||||
- name: verify that instance_group_manager was deleted
|
|
||||||
gcp_compute_instance_group_manager_info:
|
|
||||||
filters:
|
|
||||||
- name = {{ resource_name }}
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
scopes:
|
|
||||||
- https://www.googleapis.com/auth/compute
|
|
||||||
register: results
|
|
||||||
- name: verify that command succeeded
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- results['resources'] | length == 0
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
- name: delete a instance group manager that does not exist
|
|
||||||
gcp_compute_instance_group_manager:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
base_instance_name: test1-child
|
|
||||||
instance_template: "{{ instancetemplate }}"
|
|
||||||
target_size: 3
|
|
||||||
zone: us-west1-a
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: result
|
|
||||||
- name: assert changed is false
|
|
||||||
assert:
|
|
||||||
that:
|
|
||||||
- result.changed == false
|
|
||||||
#---------------------------------------------------------
|
|
||||||
# Post-test teardown
|
|
||||||
# If errors happen, don't crash the playbook!
|
|
||||||
- name: delete a instance template
|
|
||||||
gcp_compute_instance_template:
|
|
||||||
name: "{{ resource_name }}"
|
|
||||||
properties:
|
|
||||||
disks:
|
|
||||||
- auto_delete: 'true'
|
|
||||||
boot: 'true'
|
|
||||||
initialize_params:
|
|
||||||
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
|
|
||||||
machine_type: n1-standard-1
|
|
||||||
network_interfaces:
|
|
||||||
- network: "{{ network }}"
|
|
||||||
access_configs:
|
|
||||||
- name: test-config
|
|
||||||
type: ONE_TO_ONE_NAT
|
|
||||||
nat_ip: "{{ address }}"
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: instancetemplate
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a address
|
|
||||||
gcp_compute_address:
|
|
||||||
name: address-instancetemplate
|
|
||||||
region: us-west1
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: address
|
|
||||||
ignore_errors: true
|
|
||||||
- name: delete a network
|
|
||||||
gcp_compute_network:
|
|
||||||
name: network-instancetemplate
|
|
||||||
project: "{{ gcp_project }}"
|
|
||||||
auth_kind: "{{ gcp_cred_kind }}"
|
|
||||||
service_account_file: "{{ gcp_cred_file }}"
|
|
||||||
state: absent
|
|
||||||
register: network
|
|
||||||
ignore_errors: true
|
|
||||||
|
Loading…
Reference in New Issue