hetzner.hcloud.load_balancer_target module – Manage Hetzner Cloud Load Balancer targets
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_target
.
New in hetzner.hcloud 0.1.0
Synopsis
Create and delete Hetzner Cloud Load Balancer targets
Aliases: hcloud_load_balancer_target
Requirements
The below requirements are needed on the host that executes this module.
python-dateutil >= 2.7.5
requests >=2.20
Parameters
Parameter |
Comments |
---|---|
The API Endpoint for the Hetzner Cloud. You can also set this option by using the Default: |
|
The API Token for the Hetzner Cloud. You can also set this option by using the |
|
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 |
|
Name or ID of the Hetzner Cloud Load Balancer. |
|
Name or ID 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.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
hetzner.hcloud.load_balancer_target:
type: server
load_balancer: my-LoadBalancer
server: my-server
state: present
- name: Create a label_selector Load Balancer target
hetzner.hcloud.load_balancer_target:
type: label_selector
load_balancer: my-LoadBalancer
label_selector: application=backend
state: present
- name: Create an IP Load Balancer target
hetzner.hcloud.load_balancer_target:
type: ip
load_balancer: my-LoadBalancer
ip: 127.0.0.1
state: present
- name: Ensure the Load Balancer target is absent (remove if needed)
hetzner.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: |
|
Label Selector Returned: if type is label_selector Sample: |
|
Name of the Load Balancer Returned: always Sample: |
|
Name of the Server Returned: if type is server Sample: |
|
Type of the Load Balancer Target Returned: always Sample: |
|
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: |