簡體   English   中英

通過 Ansible AWS 檢查目標組目標健康狀態

[英]Check Target Group Target Health Status via Ansible AWS

我正在嘗試找到一種通過 ansible 檢查應用程序負載均衡器中目標組的目標健康狀態的方法。

有一個模塊會返回 elb_target_group_facts,但它沒有提供我需要的信息。 Ansible 還有一個用於 elb_target 的模塊,它只允許您管理目標而不是返回其當前的健康檢查狀態。

任何人都可以就使用 ansible AWS 庫檢索它的方法提出建議嗎?

要清楚我正在尋找的是與特定應用程序負載均衡器的目標組關聯的實例目標的當前運行狀況檢查狀態。

我最終無法通過 ansible 解決這個問題,因為它目前沒有公開我可以找到的目標組實例的健康檢查狀態。 相反,我直接使用python和boto3並調用方法describe_target_health來獲取健康檢查狀態。

我使用 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM