W3cubDocs

/Ansible

hetzner.hcloud.hcloud_load_balancer_target – Manage Hetzner Cloud Load Balancer targets

Note

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

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

New in version 0.1.0: of hetzner.hcloud

Synopsis

  • Create and delete Hetzner Cloud Load Balancer targets

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.
endpoint
string
Default:
"https://api.hetzner.cloud/v1"
This is the API Endpoint for the Hetzner Cloud.
ip
string
An IP from a Hetzner Dedicated Server, needs to belongs to the same user as the project.
Required if type is ip
label_selector
string
A Label Selector that will be used to determine the targets dynamically
Required if type is label_selector
load_balancer
string / required
The name of the Hetzner Cloud Load Balancer.
server
string
The name of the Hetzner Cloud Server.
Required if type is server
state
string
    Choices:
  • absent
  • present
State of the load_balancer_network.
type
string / required
    Choices:
  • server
  • label_selector
  • ip
The type of the target.
use_private_ip
boolean
    Choices:
  • no
  • yes
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.hcloud.hcloud_load_balancer_network

See Also

See also

Documentation for Hetzner Cloud API

Complete reference for the Hetzner Cloud API.

Examples

- name: Create a server Load Balancer target
  hcloud_load_balancer_target:
    type: server
    load_balancer: my-LoadBalancer
    server: my-server
    state: present

- name: Create a label_selector Load Balancer target
  hcloud_load_balancer_target:
    type: server
    load_balancer: my-LoadBalancer
    label_selector: application=backend
    state: present

- name: Create an IP Load Balancer target
  hcloud_load_balancer_target:
    type: server
    load_balancer: my-LoadBalancer
    ip: 127.0.0.1
    state: present

- name: Ensure the Load Balancer target is absent (remove if needed)
  hcloud_load_balancer_target:
    type: server
    load_balancer: my-LoadBalancer
    server: my-server
    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_target
complex
always
The relationship between a Load Balancer and a network

ip
string
if type is ip
IP of the dedicated server

Sample:
127.0.0.1
label_selector
string
if type is label_selector
Label Selector

Sample:
application=backend
load_balancer
string
always
Name of the Load Balancer

Sample:
my-LoadBalancer
server
string
if type is server
Name of the Server

Sample:
my-server
type
string
always
Type of the Load Balancer Target

Sample:
server
use_private_ip
boolean
always
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.hcloud.hcloud_load_balancer_network

Sample:
True


Authors

  • Lukas Kaemmerling (@lkaemmerling)

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