--- - name: create a global address for the load balancer. gcp_compute_global_address: name: "{{ gcp_http_lb_globaladdress }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: "{{ gcp_http_lb_state }}" register: globaladdress - name: create a http health check to verify lb working gcp_compute_http_health_check: name: "{{ gcp_http_lb_healthcheck }}" healthy_threshold: 10 port: 80 timeout_sec: 2 unhealthy_threshold: 5 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: "{{ gcp_http_lb_state }}" register: healthcheck - name: create a backend service gcp_compute_backend_service: name: "{{ gcp_http_lb_backendservice }}" backends: - group: selfLink: "{{ gcp_http_lb_backend }}" health_checks: - "{{ healthcheck.selfLink }}" enable_cdn: "{{ gcp_http_lb_cdn }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: "{{ gcp_http_lb_state }}" register: backendservice - name: create a url map gcp_compute_url_map: name: "{{ gcp_http_lb_urlmap }}" default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: "{{ gcp_http_lb_state }}" register: urlmap - name: create a target http proxy gcp_compute_target_http_proxy: name: "{{ gcp_http_lb_httpproxy }}" url_map: "{{ urlmap }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: "{{ gcp_http_lb_state }}" register: httpproxy - name: create a global forwarding rule gcp_compute_global_forwarding_rule: name: "{{ gcp_http_lb_forwardingrule }}" ip_address: "{{ globaladdress.address }}" load_balancing_scheme: "EXTERNAL" 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: "{{ gcp_http_lb_state }}" register: result