ansible.builtin.gce_lb (v2.9.27) — module

create/destroy GCE load-balancer resources

| "added in version" 1.5 of ansible.builtin"

Authors: Eric Johnson (@erjohnso) <erjohnso@google.com>

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

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.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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"

Inputs

    
name:
    description:
    - name of the load-balancer resource

state:
    choices:
    - active
    - present
    - absent
    - deleted
    default: present
    description:
    - desired state of the LB

region:
    description:
    - the GCE region where the load-balancer is defined

members:
    aliases:
    - nodes
    description:
    - a list of zone/nodename pairs, e.g ['us-central1-a/www-a', ...]

pem_file:
    description:
    - path to the pem file associated with the service account email This option is deprecated.
      Use 'credentials_file'.
    version_added: '1.6'
    version_added_collection: ansible.builtin

protocol:
    choices:
    - tcp
    - udp
    default: tcp
    description:
    - the protocol used for the load-balancer packet forwarding, tcp or udp

port_range:
    description:
    - the port (range) to forward, e.g. 80 or 8000-8888 defaults to all ports

project_id:
    description:
    - your GCE project ID
    version_added: '1.6'
    version_added_collection: ansible.builtin

external_ip:
    description:
    - the external static IPv4 (or auto-assigned) address for the LB

credentials_file:
    description:
    - path to the JSON file associated with the service account email
    version_added: 2.1.0
    version_added_collection: ansible.builtin

httphealthcheck_host:
    description:
    - host header to pass through on HTTP check requests

httphealthcheck_name:
    description:
    - the name identifier for the HTTP health check

httphealthcheck_path:
    default: /
    description:
    - the url path to use for HTTP health checking

httphealthcheck_port:
    default: 80
    description:
    - the TCP port to use for HTTP health checking

service_account_email:
    description:
    - service account email
    version_added: '1.6'
    version_added_collection: ansible.builtin

httphealthcheck_timeout:
    default: 5
    description:
    - the timeout in seconds before a request is considered a failed check

httphealthcheck_interval:
    default: 5
    description:
    - the duration in seconds between each health check request

httphealthcheck_healthy_count:
    default: 2
    description:
    - number of consecutive successful checks before marking a node healthy

httphealthcheck_unhealthy_count:
    default: 2
    description:
    - number of consecutive failed checks before marking a node unhealthy