hetzner.hcloud.load_balancer_info module – Gather infos about your Hetzner Cloud Load Balancers.

Note

This module is part of the hetzner.hcloud collection (version 3.1.1).

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 hetzner.hcloud. You need further requirements to be able to use this module, see Requirements for details.

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

Synopsis

  • Gather infos about your Hetzner Cloud Load Balancers..

Aliases: hcloud_load_balancer_info

Requirements

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

  • python-dateutil >= 2.7.5

  • requests >=2.20

Parameters

Parameter

Comments

api_endpoint

aliases: endpoint

string

The API Endpoint for the Hetzner Cloud.

You can also set this option by using the HCLOUD_ENDPOINT environment variable.

Default: "https://api.hetzner.cloud/v1"

api_token

string / required

The API Token for the Hetzner Cloud.

You can also set this option by using the HCLOUD_TOKEN environment variable.

id

integer

The ID of the Load Balancers you want to get.

The module will fail if the provided ID is invalid.

label_selector

string

The label selector for the Load Balancers you want to get.

name

string

The name of the Load Balancers you want to get.

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Gather hcloud load_balancer infos
  hetzner.hcloud.load_balancer_info:
  register: output

- name: Print the gathered infos
  debug:
    var: output

Return Values

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

Key

Description

hcloud_load_balancer_info

complex

The load_balancer infos as list

Returned: always

delete_protection

boolean

True if Load Balancer is protected for deletion

Returned: always

Sample: false

disable_public_interface

boolean

True if Load Balancer public interface is disabled

Returned: always

Sample: false

id

integer

Numeric identifier of the Load Balancer

Returned: always

Sample: 1937415

ipv4_address

string

Public IPv4 address of the Load Balancer

Returned: always

Sample: "116.203.104.109"

ipv6_address

string

Public IPv6 address of the Load Balancer

Returned: always

Sample: "2a01:4f8:1c1c:c140::1"

labels

dictionary

User-defined labels (key-value pairs)

Returned: always

load_balancer_type

string

Name of the Load Balancer type of the Load Balancer

Returned: always

Sample: "cx11"

location

string

Name of the location of the Load Balancer

Returned: always

Sample: "fsn1"

name

string

Name of the Load Balancer

Returned: always

Sample: "my-Load-Balancer"

services

complex

all services from this Load Balancer

Returned: Always

destination_port

integer

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

Returned: always

Sample: 80

health_check

complex

Configuration for health checks

Returned: always

http

complex

Additional Configuration of health checks with protocol http/https

Returned: always

domain

string

Domain we will set within the HTTP HOST header

Returned: always

Sample: "example.com"

path

string

Path we will try to access

Returned: always

Sample: "/"

response

string

Response we expect, if response is not within the health check response the target is unhealthy

Returned: always

status_codes

list / elements=string

List of HTTP status codes we expect to get when we perform the health check.

Returned: always

Sample: ["2??", "3??"]

tls

boolean

Verify the TLS certificate, only available if health check protocol is https

Returned: always

Sample: false

interval

integer

Interval of health checks, in seconds

Returned: always

Sample: 15

port

integer

Port the health check will be performed on

Returned: always

Sample: 80

protocol

string

Protocol the health checks will be performed over

Returned: always

Sample: "http"

retries

integer

Number of retries until a target is marked as unhealthy

Returned: always

Sample: 3

timeout

integer

Timeout of health checks, in seconds

Returned: always

Sample: 10

http

complex

Configuration for HTTP and HTTPS services

Returned: always

certificates

list / elements=string

List of Names or IDs of certificates

Returned: always

integer

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

Returned: always

Sample: 3600

string

Name of the cookie which will be set when you enable sticky sessions

Returned: always

Sample: "HCLBSTICKY"

redirect_http

boolean

Redirect Traffic from Port 80 to Port 443, only available if protocol is https

Returned: always

Sample: false

sticky_sessions

boolean

Enable or disable sticky_sessions

Returned: always

Sample: true

listen_port

integer

The port the service listens on, i.e. the port users can connect to.

Returned: always

Sample: 443

protocol

string

Protocol of the service

Returned: always

Sample: "http"

proxyprotocol

boolean

Enable the PROXY protocol.

Returned: always

Sample: false

status

string

Status of the Load Balancer

Returned: always

Sample: "running"

targets

complex

The targets of the Load Balancer

Returned: always

health_status

list / elements=string

List of health statuses of the services on this target. Only present for target types “server” and “ip”.

Returned: if type is server or ip

listen_port

integer

Load Balancer Target listen port

Returned: always

Sample: 80

status

string

Load Balancer Target status

Returned: always

Can only return:

  • "healthy"

  • "unhealthy"

  • "unknown"

Sample: "healthy"

ip

string

IP of the dedicated server

Returned: if type is ip

Sample: "127.0.0.1"

label_selector

string

Label Selector

Returned: if type is label_selector

Sample: "application=backend"

load_balancer

string

Name of the Load Balancer

Returned: always

Sample: "my-LoadBalancer"

server

string

Name of the Server

Returned: if type is server

Sample: "my-server"

type

string

Type of the Load Balancer Target

Returned: always

Sample: "server"

use_private_ip

boolean

Route the traffic over the private IP of the Load Balancer through a Hetzner Cloud Network.

Load Balancer needs to be attached to a network. See hetzner.hcloud.load_balancer_network

Returned: always

Sample: true

Authors

  • Lukas Kaemmerling (@LKaemmerling)