vultr.cloud.load_balancer module – Manages load balancers on Vultr
Note
This module is part of the vultr.cloud collection (version 1.14.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 vultr.cloud.
To use it in a playbook, specify: vultr.cloud.load_balancer.
New in vultr.cloud 1.14.0
Synopsis
Create, update, or delete load balancers on Vultr.
Parameters
Parameter |
Comments |
|---|---|
URL to API endpint (without trailing slash). Fallback environment variable Default: |
|
API key of the Vultr API. Fallback environment variable |
|
When receiving large numbers of resources, specify how many results should be returned per call to API. This does not determine how many results are returned; all resources are returned according to other filters. Vultr API maximum is 500. Fallback environment variable Default: |
|
Amount of retries in case of the Vultr API retuns an HTTP error code, such as - 429 Too Many Requests - 500 Internal Server Error - 504 Gateway Time-out Fallback environment variable Default: |
|
Retry backoff delay in seconds is exponential up to this max. value, in seconds. Fallback environment variable Default: |
|
HTTP timeout to Vultr API. Fallback environment variable Default: |
|
The Auto SSL configuration. Must be using Vultr DNS for Auto SSL. |
|
Subdomain to append to the domain zone |
|
The domain zone (ex. example.com) |
|
The balancing algorithm. Choices:
|
|
An array of firewall rule objects. |
|
An array of forwarding rule objects. |
|
Port on the backend. |
|
Protocol on the backend. |
|
Port on the frontend. |
|
Protocol on the frontend. |
|
Array of Region ids to deploy child Load Balancers to. |
|
The health check configuration. |
|
Interval between health checks in seconds. |
|
Number of successful health checks before marking as healthy. |
|
Path used for health checks. |
|
Port used for health checks. |
|
Protocol used for health checks. |
|
Timeout for health check responses in seconds. |
|
Number of failed health checks before marking as unhealthy. |
|
If true, this will enable HTTP2 traffic. You must have an HTTPS forwarding rule combo (HTTPS -> HTTPS) to enable this option. Choices:
|
|
If true, this will enable HTTP3/QUIC traffic. You must have HTTP2 enabled. Choices:
|
|
Array of Instance IDs to attach to this Load Balancer. Instances will be attached or detached to match your array. |
|
The label for your Load Balancer. |
|
The number of nodes to add to the load balancer (1-99), must be an odd number. Defaults to 1. Default: |
|
If true, you must configure backend nodes to accept Proxy protocol. Choices:
|
|
Region where the load balancer will be created. |
|
If true, this will redirect all HTTP traffic to HTTPS. You must have an HTTPS rule and SSL certificate installed on the load balancer to enable this option. Choices:
|
|
State of the load balancer. Choices:
|
|
Enables sticky sessions for your load balancer when a cookie_name is provided. |
|
The maximum time allowed for the connection to remain inactive before timing out in seconds. Defaults to 600. Default: |
|
Validate SSL certs of the Vultr API. Choices:
|
|
ID of the VPC you wish to use. If omitted, defaults to the public network. |
Notes
Note
Also see the API documentation on https://www.vultr.com/api/.
Examples
---
- name: Create a basic load balancer
vultr.cloud.load_balancer:
label: "example-lb"
region: "ewr"
forwarding_rules:
- frontend_protocol: "http"
frontend_port: 80
backend_protocol: "http"
backend_port: 80
- frontend_protocol: "https"
frontend_port: 443
backend_protocol: "https"
backend_port: 443
balancing_algorithm: "roundrobin"
ssl_redirect: true
http2: true
http3: false
nodes: 1
timeout: 600
health_check:
protocol: "http"
port: 80
path: "/"
check_interval: 15
response_timeout: 5
unhealthy_threshold: 3
healthy_threshold: 2
proxy_protocol: false
sticky_session: {}
instances: []
vpc: null
firewall_rules: []
auto_ssl: {}
global_regions: []
state: present
- name: Delete a load balancer
vultr.cloud.load_balancer:
label: "example-lb"
region: "ewr"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
Response from Vultr API with a few additions/modification. Returned: success |
|
Account used in the ini file to select the key. Returned: success Sample: |
|
Endpoint used for the API requests. Returned: success Sample: |
|
Amount of max retries for the API requests. Returned: success Sample: |
|
Exponential backoff delay in seconds between retries up to this max delay value. Returned: success Sample: |
|
Timeout used for the API requests. Returned: success Sample: |
|
Response from Vultr API. Returned: success |
|
Auto SSL configuration. Returned: success |
|
Date and time when the load balancer was created. Returned: success Sample: |
|
List of firewall rules. Returned: success |
|
List of forwarding rules. Returned: success |
|
Additional generic information about the load balancer. Returned: success |
|
List of global regions for the load balancer. Returned: success |
|
Whether SSL is enabled. Returned: success Sample: |
|
Health check configuration for the load balancer. Returned: success |
|
Whether HTTP/2 is enabled. Returned: success Sample: |
|
Whether HTTP/3 is enabled. Returned: success Sample: |
|
Unique identifier for the load balancer. Returned: success Sample: |
|
List of instances attached to the load balancer. Returned: success |
|
IPv4 address assigned to the load balancer. Returned: success Sample: |
|
IPv6 address assigned to the load balancer. Returned: success Sample: |
|
Name/label of the load balancer. Returned: success Sample: |
|
IP addresses of the nodes. Returned: success |
|
Number of nodes in the load balancer. Returned: success Sample: |
|
Region code where the load balancer is deployed. Returned: success Sample: |
|
Current status of the load balancer. Returned: success Sample: |