简体   繁体   English

通过 Ansible AWS 检查目标组目标健康状态

[英]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.

相关问题 AWS 目标群体健康检查 - AWS target group health check 根据目标组健康检查状态更改 Ansible 动态库存订单 - Changing Ansible dynamic inventory order based on target group health check status AWS 网络负载均衡器目标组运行状况检查状态显示不正常 - AWS Network load balancer target group health check status showing unhealthy 使用Ansible创建AWS目标组 - Creating an aws target group with ansible Amazon ECS:目标组健康检查与容器健康检查 - Amazon ECS: Target Group Health Check vs Container Health Check 将 AWS ELB 和 ACM 用于 https 时,目标组中的 502 错误和不健康的运行状况状态 - 502 error and unhealthy health status in the target group when using AWS ELB and ACM for https AWS ECS 错误:目标组中的任务未能通过 ELB 健康检查 - AWS ECS error: Task failed ELB health checks in Target group 目标运行状况检查失败 - AWS 网络负载均衡器 - Target health check fails - AWS Network Load Balancer 如何在 ALB 目标组 HTTPS 健康检查中使用证书 - How to use a certificate in an ALB target group HTTPS health check 使用 ALB 作为目标组时 NLB 运行状况检查失败 - NLB health check is failing when using ALB as the target group
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM