W3cubDocs

/Ansible 2.10

hetzner.hcloud.hcloud_load_balancer_service – Create and manage the services of cloud Load Balancers on the Hetzner Cloud.

Note

This plugin is part of the hetzner.hcloud collection.

To install it use: ansible-galaxy collection install hetzner.hcloud.

To use it in a playbook, specify: hetzner.hcloud.hcloud_load_balancer_service.

New in version 0.1.0: of hetzner.hcloud

Synopsis

  • Create, update and manage the services of cloud Load Balancers on the Hetzner Cloud.

Requirements

The below requirements are needed on the host that executes this module.

  • hcloud-python >= 1.0.0
  • hcloud-python >= 1.8.1

Parameters

Parameter Choices/Defaults Comments
api_token
string / required
This is the API Token for the Hetzner Cloud.
destination_port
integer
The port traffic is forwarded to, i.e. the port the targets are listening and accepting connections on.
Required if services does not exists and protocol is tcp.
endpoint
string
Default:
"https://api.hetzner.cloud/v1"
This is the API Endpoint for the Hetzner Cloud.
health_check
dictionary
Configuration for health checks
http
dictionary
Additional Configuration of health checks with protocol http/https
domain
string
Domain we will set within the HTTP HOST header
path
string
Path we will try to access
response
string
Response we expect, if response is not within the health check response the target is unhealthy
status_codes
list / elements=string
List of HTTP status codes we expect to get when we perform the health check.
tls
boolean
    Choices:
  • no
  • yes
Verify the TLS certificate, only available if health check protocol is https
interval
integer
Interval of health checks, in seconds
port
integer
Port the health check will be performed on
protocol
string
    Choices:
  • http
  • https
  • tcp
Protocol the health checks will be performed over
retries
integer
Number of retries until a target is marked as unhealthy
timeout
integer
Timeout of health checks, in seconds
http
dictionary
Configuration for HTTP and HTTPS services
certificates
list / elements=string
List of Names or IDs of certificates
cookie_lifetime
integer
Lifetime of the cookie which will be set when you enable sticky sessions, in seconds
cookie_name
string
Name of the cookie which will be set when you enable sticky sessions
redirect_http
boolean
    Choices:
  • no
  • yes
Redirect Traffic from Port 80 to Port 443, only available if protocol is https
sticky_sessions
boolean
    Choices:
  • no
  • yes
Enable or disable sticky_sessions
listen_port
integer / required
The port the service listens on, i.e. the port users can connect to.
load_balancer
string / required
The Name of the Hetzner Cloud Load Balancer the service belongs to
protocol
string
    Choices:
  • http
  • https
  • tcp
Protocol of the service.
Required if Load Balancer does not exists.
proxyprotocol
boolean
    Choices:
  • no
  • yes
Enable the PROXY protocol.
state
string
    Choices:
  • absent
  • present
State of the Load Balancer.

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Create a basic Load Balancer service with Port 80
  hcloud_load_balancer_service:
    load_balancer: my-load-balancer
    protocol: http
    listen_port: 80
    state: present

- name: Ensure the Load Balancer is absent (remove if needed)
  hcloud_load_balancer_service:
    load_balancer: my-Load Balancer
    protocol: http
    listen_port: 80
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
hcloud_load_balancer_service
complex
Always
The Load Balancer service instance

destination_port
integer
always
The port traffic is forwarded to, i.e. the port the targets are listening and accepting connections on.

Sample:
80
health_check
complex
always
Configuration for health checks

http
complex
always
Additional Configuration of health checks with protocol http/https

domain
string
always
Domain we will set within the HTTP HOST header

Sample:
example.com
path
string
always
Path we will try to access

Sample:
/
response
string
always
Response we expect, if response is not within the health check response the target is unhealthy

status_codes
list / elements=string
always
List of HTTP status codes we expect to get when we perform the health check.

Sample:
['2??', '3??']
tls
boolean
always
Verify the TLS certificate, only available if health check protocol is https

interval
integer
always
Interval of health checks, in seconds

Sample:
15
port
integer
always
Port the health check will be performed on

Sample:
80
protocol
string
always
Protocol the health checks will be performed over

Sample:
http
retries
integer
always
Number of retries until a target is marked as unhealthy

Sample:
3
timeout
integer
always
Timeout of health checks, in seconds

Sample:
10
http
complex
always
Configuration for HTTP and HTTPS services

certificates
list / elements=string
always
List of Names or IDs of certificates

cookie_lifetime
integer
always
Lifetime of the cookie which will be set when you enable sticky sessions, in seconds

Sample:
3600
cookie_name
string
always
Name of the cookie which will be set when you enable sticky sessions

Sample:
HCLBSTICKY
redirect_http
boolean
always
Redirect Traffic from Port 80 to Port 443, only available if protocol is https

sticky_sessions
boolean
always
Enable or disable sticky_sessions

Sample:
True
listen_port
integer
always
The port the service listens on, i.e. the port users can connect to.

Sample:
443
load_balancer
string
always
The name of the Load Balancer where the service belongs to

Sample:
my-load-balancer
protocol
string
always
Protocol of the service

Sample:
http
proxyprotocol
boolean
always
Enable the PROXY protocol.



Authors

  • Lukas Kaemmerling (@LKaemmerling)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/hetzner/hcloud/hcloud_load_balancer_service_module.html