1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

feat: target health status in hcloud_load_balancer_info (#305)

This commit is contained in:
Jonas L 2023-08-17 15:25:14 +02:00 committed by GitHub
parent 7d2300f1ec
commit 5475a9929a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View file

@ -138,6 +138,23 @@ hcloud_load_balancer_info:
type: bool
sample: true
returned: always
health_status:
description:
- List of health statuses of the services on this target. Only present for target types "server" and "ip".
type: list
returned: if I(type) is server or ip
contains:
listen_port:
description: Load Balancer Target listen port
type: int
returned: always
sample: 80
status:
description: Load Balancer Target status
type: str
choices: [healthy, unhealthy, unknown]
returned: always
sample: healthy
services:
description: all services from this Load Balancer
returned: Always
@ -345,6 +362,16 @@ class AnsibleHCloudLoadBalancerInfo(AnsibleHCloud):
result["label_selector"] = to_native(target.label_selector.selector)
elif target.type == "ip":
result["ip"] = to_native(target.ip.ip)
if target.health_status is not None:
result["health_status"] = [
{
"listen_port": item.listen_port,
"status": item.status,
}
for item in target.health_status
]
return result
def get_load_balancers(self):