community / community.google / 1.0.0 / module / gce_lb create/destroy GCE load-balancer resources Authors: Eric Johnson (@erjohnso) <erjohnso@google.com>community.google.gce_lb (1.0.0) — module
Install with ansible-galaxy collection install community.google:==1.0.0
collections: - name: community.google version: 1.0.0
This module can create and destroy Google Compute Engine C(loadbalancer) and C(httphealthcheck) resources. The primary LB resource is the C(load_balancer) resource and the health check parameters are all prefixed with I(httphealthcheck). The full documentation for Google Compute Engine load balancing is at U(https://developers.google.com/compute/docs/load-balancing/). However, the ansible module simplifies the configuration by following the libcloud model. Full install/configuration instructions for the gce* modules can be found in the comments of ansible/test/gce_tests.py.
- name: Simple example of creating a new LB, adding members, and a health check local_action: module: gce_lb name: testlb region: us-central1 members: ["us-central1-a/www-a", "us-central1-b/www-b"] httphealthcheck_name: hc httphealthcheck_port: 80 httphealthcheck_path: "/up"
name: description: - name of the load-balancer resource type: str state: default: present description: - desired state of the LB - 'the available choices are: C(active), C(present), C(absent), C(deleted).' type: str region: description: - the GCE region where the load-balancer is defined type: str members: description: - a list of zone/nodename pairs, e.g ['us-central1-a/www-a', ...] type: list pem_file: description: - path to the pem file associated with the service account email This option is deprecated. Use 'credentials_file'. type: path protocol: default: tcp description: - the protocol used for the load-balancer packet forwarding, tcp or udp - 'the available choices are: C(tcp) or C(udp).' type: str port_range: description: - the port (range) to forward, e.g. 80 or 8000-8888 defaults to all ports type: str project_id: description: - your GCE project ID type: str external_ip: description: - the external static IPv4 (or auto-assigned) address for the LB type: str credentials_file: description: - path to the JSON file associated with the service account email type: path httphealthcheck_host: description: - host header to pass through on HTTP check requests type: str httphealthcheck_name: description: - the name identifier for the HTTP health check type: str httphealthcheck_path: default: / description: - the url path to use for HTTP health checking type: str httphealthcheck_port: default: 80 description: - the TCP port to use for HTTP health checking type: int service_account_email: description: - service account email type: str httphealthcheck_timeout: default: 5 description: - the timeout in seconds before a request is considered a failed check type: int httphealthcheck_interval: default: 5 description: - the duration in seconds between each health check request type: int httphealthcheck_healthy_count: default: 2 description: - number of consecutive successful checks before marking a node healthy type: int httphealthcheck_unhealthy_count: default: 2 description: - number of consecutive failed checks before marking a node unhealthy type: int