hetzner.hcloud.load_balancer module – Create and manage cloud Load Balancers on the Hetzner Cloud.

Note

This module is part of the hetzner.hcloud collection (version 2.5.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 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.

New in hetzner.hcloud 0.1.0

Synopsis

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

Aliases: hcloud_load_balancer

Requirements

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

  • python-dateutil >= 2.7.5

  • requests >=2.20

Parameters

Parameter

Comments

algorithm

string

Algorithm of the Load Balancer.

Choices:

  • "round_robin" ← (default)

  • "least_connections"

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.

delete_protection

boolean

Protect the Load Balancer for deletion.

Choices:

  • false

  • true

disable_public_interface

boolean

Disables the public interface.

Choices:

  • false ← (default)

  • true

id

integer

The ID of the Hetzner Cloud Load Balancer to manage.

Only required if no Load Balancer name is given

labels

dictionary

User-defined labels (key-value pairs).

load_balancer_type

string

The Load Balancer Type of the Hetzner Cloud Load Balancer to manage.

Required if Load Balancer does not exist.

location

string

Location of Load Balancer.

Required if no network_zone is given and Load Balancer does not exist.

name

string

The Name of the Hetzner Cloud Load Balancer to manage.

Only required if no Load Balancer id is given or a Load Balancer does not exist.

network_zone

string

Network Zone of Load Balancer.

Required of no location is given and Load Balancer does not exist.

state

string

State of the Load Balancer.

Choices:

  • "absent"

  • "present" ← (default)

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Create a basic Load Balancer
  hetzner.hcloud.load_balancer:
    name: my-Load Balancer
    load_balancer_type: lb11
    algorithm: round_robin
    location: fsn1
    state: present

- name: Ensure the Load Balancer is absent (remove if needed)
  hetzner.hcloud.load_balancer:
    name: my-Load Balancer
    state: absent

Return Values

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

Key

Description

hcloud_load_balancer

complex

The Load Balancer instance

Returned: Always

algorithm

string

Algorithm of the Load Balancer.

Returned: always

Can only return:

  • "round_robin"

  • "least_connections"

Sample: "round_robin"

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"

status

string

Status of the Load Balancer

Returned: always

Sample: "running"

Authors

  • Lukas Kaemmerling (@LKaemmerling)