|
|
|
@ -15,87 +15,87 @@
|
|
|
|
|
# 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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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 }}"
|
|
|
|
|
health_checks:
|
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
|
enable_cdn: true
|
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
|
state: present
|
|
|
|
|
name: backendservice-globalforwardingrule
|
|
|
|
|
backends:
|
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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: "{{ 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
|
|
|
|
|
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:
|
|
|
|
@ -119,15 +119,15 @@
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
- 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
|
|
|
|
|
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:
|
|
|
|
@ -137,15 +137,15 @@
|
|
|
|
|
#----------------------------------------------------------
|
|
|
|
|
- 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: "{{ 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:
|
|
|
|
@ -169,15 +169,15 @@
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
- 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
|
|
|
|
|
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:
|
|
|
|
@ -189,67 +189,67 @@
|
|
|
|
|
# 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
|
|
|
|
|
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
|
|
|
|
|
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 }}"
|
|
|
|
|
health_checks:
|
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
|
enable_cdn: true
|
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
|
state: absent
|
|
|
|
|
name: backendservice-globalforwardingrule
|
|
|
|
|
backends:
|
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
name: globaladdress-globalforwardingrule
|
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
|
state: absent
|
|
|
|
|
register: globaladdress
|
|
|
|
|
ignore_errors: true
|
|
|
|
|