[英]Check Target Group Target Health Status via Ansible AWS
I am trying to find a method of checking a targets health status for a target group within an Application Load Balancer via ansible.我正在尝试找到一种通过 ansible 检查应用程序负载均衡器中目标组的目标健康状态的方法。
There is a module that returns elb_target_group_facts which do not give me the information I need.有一个模块会返回 elb_target_group_facts,但它没有提供我需要的信息。 Ansible also has a module for elb_target which only allows you to manage a target rather than returning its current health check status.
Ansible 还有一个用于 elb_target 的模块,它只允许您管理目标而不是返回其当前的健康检查状态。
Can anyone advise on a method of retrieving this using the ansible AWS libraries?任何人都可以就使用 ansible AWS 库检索它的方法提出建议吗?
To be clear what I am looking for is the current health check status for an instance target associated with a target group for a particular Application Load Balancer.要清楚我正在寻找的是与特定应用程序负载均衡器的目标组关联的实例目标的当前运行状况检查状态。
I was unable to resolve this through ansible in the end as it does not currently expose health check status for the target group instances that I could find.我最终无法通过 ansible 解决这个问题,因为它目前没有公开我可以找到的目标组实例的健康检查状态。 Instead I used python and boto3 directly and called the method describe_target_health to get the health check status.
相反,我直接使用python和boto3并调用方法describe_target_health来获取健康检查状态。
I used awscli wait for that:我使用 awscli 等待:
- name: "wait for target group- ({{ TARGET_GROUP_ARN | quote }}) attached to a LB to become healthy"
# The awscli command It will poll every 15 seconds until a successful state has been reached.
# This will exit with a return code of 255 after 40 failed checks.
command: >-
aws --region {{ AWS_REGION }} elbv2 wait
target-in-service --target-group-arn {{ TARGET_GROUP_ARN | quote }}
delegate_to: 127.0.0.1
tags: liveness
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.