W3cubDocs

/Ansible

gce_lb - create/destroy GCE load-balancer resources

New in version 1.5.

Synopsis

This module can create and destroy Google Compute Engine loadbalancer and httphealthcheck resources. The primary LB resource is the load_balancer resource and the health check parameters are all prefixed with httphealthcheck. The full documentation for Google Compute Engine load balancing is at 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 (on host that executes module)

  • python >= 2.6
  • apache-libcloud >= 0.13.3, >= 0.17.0 if using JSON credentials

Options

parameter required default choices comments
credentials_file
(added in 2.1.0)
no
path to the JSON file associated with the service account email
external_ip
no
the external static IPv4 (or auto-assigned) address for the LB
httphealthcheck_healthy_count
no 2
number of consecutive successful checks before marking a node healthy
httphealthcheck_host
no
host header to pass through on HTTP check requests
httphealthcheck_interval
no 5
the duration in seconds between each health check request
httphealthcheck_name
no
the name identifier for the HTTP health check
httphealthcheck_path
no /
the url path to use for HTTP health checking
httphealthcheck_port
no 80
the TCP port to use for HTTP health checking
httphealthcheck_timeout
no 5
the timeout in seconds before a request is considered a failed check
httphealthcheck_unhealthy_count
no 2
number of consecutive failed checks before marking a node unhealthy
members
no
a list of zone/nodename pairs, e.g ['us-central1-a/www-a', ...]
aliases: nodes
name
no
name of the load-balancer resource
pem_file
(added in 1.6)
no
path to the pem file associated with the service account email This option is deprecated. Use 'credentials_file'.
port_range
no
the port (range) to forward, e.g. 80 or 8000-8888 defaults to all ports
project_id
(added in 1.6)
no
your GCE project ID
protocol
no tcp
  • tcp
  • udp
the protocol used for the load-balancer packet forwarding, tcp or udp
region
no
the GCE region where the load-balancer is defined
service_account_email
(added in 1.6)
no
service account email
state
no present
  • active
  • present
  • absent
  • deleted
desired state of the LB

Examples

# 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"

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/gce_lb_module.html