community.digitalocean.digital_ocean_load_balancer module – Manage DigitalOcean Load Balancers
Note
This module is part of the community.digitalocean collection (version 1.27.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.digitalocean
.
To use it in a playbook, specify: community.digitalocean.digital_ocean_load_balancer
.
New in community.digitalocean 1.10.0
Synopsis
Manage DigitalOcean Load Balancers
Parameters
Parameter |
Comments |
---|---|
DigitalOcean API base url. Default: |
|
An array containing the IDs of the Droplets assigned to the load balancer. Required when creating load balancers. Mutually exclusive with tag, you can either define tag or droplet_ids but not both. |
|
A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Choices:
|
|
A boolean value indicating whether PROXY Protocol is in use. Choices:
|
|
An array of objects specifying the forwarding rules for a load balancer. Required when creating load balancers. Default: |
|
Certificate ID Default: |
|
Entry port Default: |
|
Entry protocol Default: |
|
Target port Default: |
|
Target protocol Default: |
|
TLS passthrough Choices:
|
|
An object specifying health check settings for the load balancer. Default: |
|
Check interval seconds Default: |
|
Healthy threshold Default: |
|
Path Default: |
|
Port Default: |
|
Protocol Default: |
|
Response timeout seconds Default: |
|
Unhealthy threshold Default: |
|
A human-readable name for a load balancer instance. Required and must be unique (current API documentation is not up-to-date for this parameter). |
|
DigitalOcean OAuth token. There are several other environment variables which can be used to provide this value. i.e., - |
|
Project to assign the resource to (project name, not UUID). Defaults to the default project of the account (empty string). Currently only supported when creating. Default: |
|
A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443. Choices:
|
|
The slug identifier for the region where the resource will initially be available. |
|
The size of the load balancer. The available sizes are You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation. This field has been replaced by the Each available load balancer size now equates to the load balancer having a set number of nodes. The formula is Choices:
|
|
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 Use the The value must be in the range 1-100. Default: |
|
The usual, Choices:
|
|
An object specifying sticky sessions settings for the load balancer. Default: |
|
Type Default: |
|
A tag associated with the droplets that you want to dynamically assign to the load balancer. Required when creating load balancers. Mutually exclusive with droplet_ids, you can either define tag or droplet_ids but not both. |
|
The timeout in seconds used for polling DigitalOcean’s API. Default: |
|
If set to This should only set to Choices:
|
|
A string specifying the UUID of the VPC to which the load balancer is assigned. If unspecified, uses the default VPC in the region. |
|
Wait for the Load Balancer to be running before returning. Choices:
|
|
How long before wait gives up, in seconds, when creating a Load Balancer. Default: |
Examples
- name: Create a Load Balancer
community.digitalocean.digital_ocean_load_balancer:
state: present
name: test-loadbalancer-1
droplet_ids:
- 12345678
region: nyc1
forwarding_rules:
- entry_protocol: http
entry_port: 8080
target_protocol: http
target_port: 8080
certificate_id: ""
tls_passthrough: false
- name: Create a Load Balancer (and assign to Project "test")
community.digitalocean.digital_ocean_load_balancer:
state: present
name: test-loadbalancer-1
droplet_ids:
- 12345678
region: nyc1
forwarding_rules:
- entry_protocol: http
entry_port: 8080
target_protocol: http
target_port: 8080
certificate_id: ""
tls_passthrough: false
project: test
- name: Create a Load Balancer and associate it with a tag
community.digitalocean.digital_ocean_load_balancer:
state: present
name: test-loadbalancer-1
tag: test-tag
region: tor1
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Assignment status (ok, not_found, assigned, already_assigned, service_down) Returned: changed Sample: |
|
A DigitalOcean Load Balancer Returned: changed Sample: |
|
Informational or error message encountered during execution Returned: changed Sample: |
|
Resource assignment involved in project assignment Returned: changed Sample: |