hetzner.hcloud.hcloud_load_balancer_target module – Manage Hetzner Cloud Load Balancer targets
Note
This module 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
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 |
Comments |
---|---|
This is the API Token for the Hetzner Cloud. |
|
This is the API Endpoint for the Hetzner Cloud. Default: “https://api.hetzner.cloud/v1” |
|
An IP from a Hetzner Dedicated Server, needs to belongs to the same user as the project. Required if type is ip |
|
A Label Selector that will be used to determine the targets dynamically Required if type is label_selector |
|
The name of the Hetzner Cloud Load Balancer. |
|
The name of the Hetzner Cloud Server. Required if type is server |
|
State of the load_balancer_network. Choices:
|
|
The type of the target. Choices:
|
|
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 Choices:
|
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 |
Description |
---|---|
The relationship between a Load Balancer and a network Returned: always |
|
IP of the dedicated server Returned: if type is ip Sample: “127.0.0.1” |
|
Label Selector Returned: if type is label_selector Sample: “application=backend” |
|
Name of the Load Balancer Returned: always Sample: “my-LoadBalancer” |
|
Name of the Server Returned: if type is server Sample: “my-server” |
|
Type of the Load Balancer Target Returned: always Sample: “server” |
|
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 Returned: always Sample: true |
Authors
Lukas Kaemmerling (@lkaemmerling)