|
|
@ -15,87 +15,87 @@
|
|
|
|
# Pre-test setup
|
|
|
|
# Pre-test setup
|
|
|
|
- name: create a global address
|
|
|
|
- name: create a global address
|
|
|
|
gcp_compute_global_address:
|
|
|
|
gcp_compute_global_address:
|
|
|
|
name: "globaladdress-globalforwardingrule"
|
|
|
|
name: globaladdress-globalforwardingrule
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: globaladdress
|
|
|
|
register: globaladdress
|
|
|
|
- name: create a instance group
|
|
|
|
- name: create a instance group
|
|
|
|
gcp_compute_instance_group:
|
|
|
|
gcp_compute_instance_group:
|
|
|
|
name: "instancegroup-globalforwardingrule"
|
|
|
|
name: instancegroup-globalforwardingrule
|
|
|
|
zone: us-central1-a
|
|
|
|
zone: us-central1-a
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: instancegroup
|
|
|
|
register: instancegroup
|
|
|
|
- name: create a http health check
|
|
|
|
- name: create a http health check
|
|
|
|
gcp_compute_http_health_check:
|
|
|
|
gcp_compute_http_health_check:
|
|
|
|
name: "httphealthcheck-globalforwardingrule"
|
|
|
|
name: httphealthcheck-globalforwardingrule
|
|
|
|
healthy_threshold: 10
|
|
|
|
healthy_threshold: 10
|
|
|
|
port: 8080
|
|
|
|
port: 8080
|
|
|
|
timeout_sec: 2
|
|
|
|
timeout_sec: 2
|
|
|
|
unhealthy_threshold: 5
|
|
|
|
unhealthy_threshold: 5
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: healthcheck
|
|
|
|
register: healthcheck
|
|
|
|
- name: create a backend service
|
|
|
|
- name: create a backend service
|
|
|
|
gcp_compute_backend_service:
|
|
|
|
gcp_compute_backend_service:
|
|
|
|
name: "backendservice-globalforwardingrule"
|
|
|
|
name: backendservice-globalforwardingrule
|
|
|
|
backends:
|
|
|
|
backends:
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
health_checks:
|
|
|
|
health_checks:
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
enable_cdn: true
|
|
|
|
enable_cdn: 'true'
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: backendservice
|
|
|
|
register: backendservice
|
|
|
|
- name: create a url map
|
|
|
|
- name: create a url map
|
|
|
|
gcp_compute_url_map:
|
|
|
|
gcp_compute_url_map:
|
|
|
|
name: "urlmap-globalforwardingrule"
|
|
|
|
name: urlmap-globalforwardingrule
|
|
|
|
default_service: "{{ backendservice }}"
|
|
|
|
default_service: "{{ backendservice }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: urlmap
|
|
|
|
register: urlmap
|
|
|
|
- name: create a target http proxy
|
|
|
|
- name: create a target http proxy
|
|
|
|
gcp_compute_target_http_proxy:
|
|
|
|
gcp_compute_target_http_proxy:
|
|
|
|
name: "targethttpproxy-globalforwardingrule"
|
|
|
|
name: targethttpproxy-globalforwardingrule
|
|
|
|
url_map: "{{ urlmap }}"
|
|
|
|
url_map: "{{ urlmap }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: httpproxy
|
|
|
|
register: httpproxy
|
|
|
|
- name: delete a global forwarding rule
|
|
|
|
- name: delete a global forwarding rule
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_protocol: TCP
|
|
|
|
ip_protocol: TCP
|
|
|
|
port_range: 80-80
|
|
|
|
port_range: 80-80
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
#----------------------------------------------------------
|
|
|
|
#----------------------------------------------------------
|
|
|
|
- name: create a global forwarding rule
|
|
|
|
- name: create a global forwarding rule
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_protocol: TCP
|
|
|
|
ip_protocol: TCP
|
|
|
|
port_range: 80-80
|
|
|
|
port_range: 80-80
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
- name: assert changed is true
|
|
|
|
- name: assert changed is true
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -119,15 +119,15 @@
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
- name: create a global forwarding rule that already exists
|
|
|
|
- name: create a global forwarding rule that already exists
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_protocol: TCP
|
|
|
|
ip_protocol: TCP
|
|
|
|
port_range: 80-80
|
|
|
|
port_range: 80-80
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: present
|
|
|
|
state: present
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
- name: assert changed is false
|
|
|
|
- name: assert changed is false
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -137,15 +137,15 @@
|
|
|
|
#----------------------------------------------------------
|
|
|
|
#----------------------------------------------------------
|
|
|
|
- name: delete a global forwarding rule
|
|
|
|
- name: delete a global forwarding rule
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_protocol: TCP
|
|
|
|
ip_protocol: TCP
|
|
|
|
port_range: 80-80
|
|
|
|
port_range: 80-80
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
- name: assert changed is true
|
|
|
|
- name: assert changed is true
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -169,15 +169,15 @@
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
- name: delete a global forwarding rule that does not exist
|
|
|
|
- name: delete a global forwarding rule that does not exist
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
gcp_compute_global_forwarding_rule:
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
name: "{{ resource_name }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_address: "{{ globaladdress.address }}"
|
|
|
|
ip_protocol: TCP
|
|
|
|
ip_protocol: TCP
|
|
|
|
port_range: 80-80
|
|
|
|
port_range: 80-80
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
target: "{{ httpproxy.selfLink }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: result
|
|
|
|
register: result
|
|
|
|
- name: assert changed is false
|
|
|
|
- name: assert changed is false
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
@ -189,67 +189,67 @@
|
|
|
|
# If errors happen, don't crash the playbook!
|
|
|
|
# If errors happen, don't crash the playbook!
|
|
|
|
- name: delete a target http proxy
|
|
|
|
- name: delete a target http proxy
|
|
|
|
gcp_compute_target_http_proxy:
|
|
|
|
gcp_compute_target_http_proxy:
|
|
|
|
name: "targethttpproxy-globalforwardingrule"
|
|
|
|
name: targethttpproxy-globalforwardingrule
|
|
|
|
url_map: "{{ urlmap }}"
|
|
|
|
url_map: "{{ urlmap }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: httpproxy
|
|
|
|
register: httpproxy
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|
- name: delete a url map
|
|
|
|
- name: delete a url map
|
|
|
|
gcp_compute_url_map:
|
|
|
|
gcp_compute_url_map:
|
|
|
|
name: "urlmap-globalforwardingrule"
|
|
|
|
name: urlmap-globalforwardingrule
|
|
|
|
default_service: "{{ backendservice }}"
|
|
|
|
default_service: "{{ backendservice }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: urlmap
|
|
|
|
register: urlmap
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|
- name: delete a backend service
|
|
|
|
- name: delete a backend service
|
|
|
|
gcp_compute_backend_service:
|
|
|
|
gcp_compute_backend_service:
|
|
|
|
name: "backendservice-globalforwardingrule"
|
|
|
|
name: backendservice-globalforwardingrule
|
|
|
|
backends:
|
|
|
|
backends:
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
- group: "{{ instancegroup }}"
|
|
|
|
health_checks:
|
|
|
|
health_checks:
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
- "{{ healthcheck.selfLink }}"
|
|
|
|
enable_cdn: true
|
|
|
|
enable_cdn: 'true'
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: backendservice
|
|
|
|
register: backendservice
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|
- name: delete a http health check
|
|
|
|
- name: delete a http health check
|
|
|
|
gcp_compute_http_health_check:
|
|
|
|
gcp_compute_http_health_check:
|
|
|
|
name: "httphealthcheck-globalforwardingrule"
|
|
|
|
name: httphealthcheck-globalforwardingrule
|
|
|
|
healthy_threshold: 10
|
|
|
|
healthy_threshold: 10
|
|
|
|
port: 8080
|
|
|
|
port: 8080
|
|
|
|
timeout_sec: 2
|
|
|
|
timeout_sec: 2
|
|
|
|
unhealthy_threshold: 5
|
|
|
|
unhealthy_threshold: 5
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: healthcheck
|
|
|
|
register: healthcheck
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|
- name: delete a instance group
|
|
|
|
- name: delete a instance group
|
|
|
|
gcp_compute_instance_group:
|
|
|
|
gcp_compute_instance_group:
|
|
|
|
name: "instancegroup-globalforwardingrule"
|
|
|
|
name: instancegroup-globalforwardingrule
|
|
|
|
zone: us-central1-a
|
|
|
|
zone: us-central1-a
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: instancegroup
|
|
|
|
register: instancegroup
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|
- name: delete a global address
|
|
|
|
- name: delete a global address
|
|
|
|
gcp_compute_global_address:
|
|
|
|
gcp_compute_global_address:
|
|
|
|
name: "globaladdress-globalforwardingrule"
|
|
|
|
name: globaladdress-globalforwardingrule
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
project: "{{ gcp_project }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
auth_kind: "{{ gcp_cred_kind }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
service_account_file: "{{ gcp_cred_file }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
register: globaladdress
|
|
|
|
register: globaladdress
|
|
|
|
ignore_errors: true
|
|
|
|
ignore_errors: true
|
|
|
|