load_balancer

Synopsis

Requirements

  • pydo >= 0.1.3
  • azure-core >= 1.26.1

Parameters

Parameter Choices Default Comments
client_override_options
(dict)
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options.
disable_lets_encrypt_dns_records
(bool)
False A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.
droplet_ids
(list)
An array containing the IDs of the Droplets assigned to the load balancer.
enable_backend_keepalive
(bool)
False A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.
enable_proxy_protocol
(bool)
False A boolean value indicating whether PROXY Protocol is in use.
firewall
(dict)
An object specifying allow and deny rules to control traffic to the load balancer.
forwarding_rules
(list)
An array of objects specifying the forwarding rules for a load balancer.
health_checks
(dict)
An object specifying health check settings for the load balancer.
http_idle_timeout_seconds
(int)
60 An integer value which configures the idle timeout for HTTP requests to the target droplets.
module_override_options
(dict)
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options.
name
(str)
A human-readable name for a load balancer instance.
project_id
(str)
The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created.
redirect_http_to_https
(bool)
False A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.
region
(str)
The slug identifier for the region where the resource will initially be available.
size
(str)
  • lb-small
  • lb-medium
  • lb-large
lb-small Deprecated. This field has been replaced by the size_unit field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes. lb-small = 1 node, lb-medium = 3 nodes, lb-large = 6 nodes.
size_unit
(int)
1 How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.
state
(str)
  • present
  • absent
present State of the resource, present to create, absent to destroy.
sticky_sessions
(dict)
An object specifying sticky sessions settings for the load balancer.
timeout
(int)
300 Polling timeout in seconds.
token
(str)
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN, DIGITALOCEAN_TOKEN, DO_API_TOKEN, DO_API_KEY, DO_OAUTH_TOKEN and OAUTH_TOKEN
vpc_uuid
(str)
A string specifying the UUID of the VPC to which the load balancer is assigned.

Examples

- name: Create load balancer
  digitalocean.cloud.load_balancer:
    token: "{{ token }}"
    state: present
    name: example-lb1
    region: nyc3
    forwarding_rules:
      - entry_protocol: http
        entry_port: 80
        target_protocol: http
        target_port: 80
      - entry_protocol: https
        entry_port: 443
        target_protocol: https
        target_port: 443
        tls_passthrough: true
    droplet_ids:
      - 11223344
    disable_lets_encrypt_dns_records: true
    http_idle_timeout_seconds: 60
    firewall:
      deny:
        - cidr:1.2.0.0/16
        - ip:2.3.4.5
      allow:
        - ip:1.2.3.4
        - cidr:2.3.4.0/24

Return Values

Key Returned Description
error
(dict)
failure DigitalOcean API error.

Sample:

{
  "Message": "Informational error message.",
  "Reason": "Unauthorized",
  "Status Code": 401
}
load_balancer
(dict)
always Load balancer information.

Sample:

null
msg
(str)
always Droplet result information.

Sample:

[
  "Created load balancer example-lb-01 (e23647ff-4b57-4da0-8f31-72616d932c0d)",
  "Deleted load balancer example-lb-01 (e23647ff-4b57-4da0-8f31-72616d932c0d)",
  "Load balancer example-lb-01 would be created",
  "Load balancer example-lb-01 (e23647ff-4b57-4da0-8f31-72616d932c0d) exists",
  "Load balancer example-lb-01 does not exist",
  "Load balancer example-lb-01 (e23647ff-4b57-4da0-8f31-72616d932c0d) would be deleted"
]