-
Notifications
You must be signed in to change notification settings - Fork 0
/
shoplauncher-lb.yml
98 lines (91 loc) · 3.2 KB
/
shoplauncher-lb.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
- name: Set up shoplauncherer loadbalancer networking
hosts: localhost
gather_facts: False
vars_files:
- gce_vars/auth
- gce_vars/zone
tasks:
- name: create a global address for shoplauncherer
gcp_compute_global_address:
name: "sl-globaladdress-globalforwardingrule1"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
register: sl_globaladdress
- name: create a shoplauncherapp instance group
gcp_compute_instance_group:
name: "sl-instancegroup-globalforwardingrule"
zone: "{{ zone.za }}"
instances:
- "{{ shoplauncherappinstance1 }}"
- "{{ shoplauncherappinstance2 }}"
- "{{ shoplauncherappinstance3 }}"
named_ports:
- name: http
port: 80
network: "{{ network }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: shoplauncherapp_ig
- name: create a http health check
gcp_compute_http_health_check:
name: "httphealthcheck-shoplauncher"
port: 80
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: shoplauncherapp_hc
- name: create a backend shoplauncherer app service
gcp_compute_backend_service:
name: "shoplauncher-bes-globalforwardingrule"
backends:
- group: "{{ shoplauncherapp_ig.selfLink }}"
health_checks:
- "{{ shoplauncherapp_hc.selfLink }}"
enable_cdn: 'true'
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: shoplauncherapp_bes
ignore_errors: yes
- name: create a url map
gcp_compute_url_map:
name: "sl-urlmap-globalforwardingrule"
default_service: "{{ shoplauncherapp_bes }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: slurlmap
- name: create a target http proxy
gcp_compute_target_http_proxy:
name: "sl-httpproxy-globalforwardingrule"
url_map: "{{ slurlmap }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: sl_httpproxy
- name: create a global forwarding rule
gcp_compute_global_forwarding_rule:
name: "sl-globalfowardingrule"
ip_address: "{{ sl_globaladdress.address }}"
load_balancing_scheme: "EXTERNAL"
ip_protocol: TCP
port_range: 80-80
target: "{{ sl_httpproxy.selfLink }}"
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
register: slforwardingrule
post_tasks:
- debug:
msg: "Load balancer IP: {{ slforwardingrule['IPAddress'] }}"