cloudscale_ch.cloud.load_balancer_health_monitor 模块 – 管理 cloudscale.ch IaaS 服务上的负载均衡器
注意
此模块是 cloudscale_ch.cloud 集合(版本 2.4.0)的一部分。
如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用: ansible-galaxy collection install cloudscale_ch.cloud。
要在 playbook 中使用它,请指定: cloudscale_ch.cloud.load_balancer_health_monitor。
cloudscale_ch.cloud 2.3.0 中的新功能
概要
- 在 cloudscale.ch IaaS 服务上获取、创建、更新、删除健康监视器。 
参数
| 参数 | 注释 | 
|---|---|
| 调用 cloudscale.ch API 的超时时间(以秒为单位)。 也可以在  默认值:  | |
| cloudscale.ch API 令牌。 也可以在  | |
| cloudscale.ch API URL。 也可以在  默认值:  | |
| 两次连续检查之间的延迟(以秒为单位)。 | |
| 在池成员的 monitor_status 更改为“down”之前需要失败的检查次数。 | |
| 类型为“http”或“https”的健康监视器的高级选项。 | |
| 允许将检查视为成功的 HTTP 状态代码。 有关详细信息,请参阅[API 文档](https://www.cloudscale.ch/en/api/v1#http-attribute-specification)。 | |
| 检查中使用的 HTTP Host 标头中的服务器名称。 需要将版本设置为“1.1”。 | |
| 检查中使用的 HTTP 方法。 | |
| 检查中使用的 URL。 | |
| 检查中使用的 HTTP 版本。 | |
| 健康监视器的池。 | |
| 负载均衡器健康监视器的状态。 选择 
 | |
| 与负载均衡器关联的标签。将此设置为  | |
| 允许单次检查的最长时间(以秒为单位)。 | |
| 健康监视器的类型。 有关允许的选项,请参阅[API 文档](https://www.cloudscale.ch/en/api/v1#create-a-health-monitor)。 | |
| 在池成员的 monitor_status 更改为“up”之前需要成功的检查次数。 | |
| 负载均衡器健康监视器的 UUID。 | 
备注
注意
- 健康监视器没有名称。uuid 用于引用健康监视器。 
- 所有操作都使用 cloudscale.ch 公共 API v1 执行。 
- 有关详细信息,请参阅完整的 API 文档:https://www.cloudscale.ch/en/api/v1。 
- 所有操作都需要有效的 API 令牌。您可以使用 cloudscale.ch 控制面板在 https://control.cloudscale.ch 创建任意数量的令牌。 
示例
# Create a simple health monitor for a pool
- name: Create a load balancer pool
  cloudscale_ch.cloud.load_balancer_pool:
    name: 'swimming-pool'
    load_balancer: '3d41b118-f95c-4897-ad74-2260fea783fc'
    algorithm: 'round_robin'
    protocol: 'tcp'
    api_token: xxxxxx
  register: load_balancer_pool
- name: Create a load balancer health monitor (ping)
  cloudscale_ch.cloud.load_balancer_health_monitor:
    pool: '{{ load_balancer_pool.uuid }}'
    type: 'ping'
    api_token: xxxxxx
  register: load_balancer_health_monitor
# Get load balancer health monitor facts by UUID
- name: Get facts of a load balancer health monitor by UUID
  cloudscale_ch.cloud.load_balancer_health_monitor:
    uuid: '{{ load_balancer_health_monitor.uuid }}'
    api_token: xxxxxx
# Update a health monitor
- name: Update HTTP method of a load balancer health monitor from GET to CONNECT
  cloudscale_ch.cloud.load_balancer_health_monitor:
    uuid: '{{ load_balancer_health_monitor_http.uuid }}'
    delay_s: 2
    timeout_s: 1
    up_threshold: 2
    down_threshold: 3
    type: 'http'
    http:
      expected_codes:
        - 200
        - 202
      method: 'CONNECT'
      url_path: '/'
      version: '1.1'
      host: 'host1'
    tags:
      project: ansible-test
      stage: production
      sla: 24-7
    api_token: xxxxxx
  register: load_balancer_health_monitor
返回值
常见的返回值记录在此处,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 负载均衡器健康监视器的创建日期和时间 返回: 当 state != absent 时成功 示例:  | |
| 两次连续检查之间的延迟(以秒为单位) 返回: 当 state != absent 时成功 示例:  | |
| 在池成员的 monitor_status 更改为“down”之前需要失败的检查次数 返回: 当 state != absent 时成功 示例:  | |
| 用于获取有关此负载均衡器健康监视器的详细信息的 API URL 返回: 当 state != absent 时成功 示例:  | |
| 类型为 “http” 或 “https” 的健康检查的高级选项 返回: 当 state != absent 时成功 示例:  | |
| 健康检查的池 返回: 当 state != absent 时成功 示例:  | |
| 与负载均衡器关联的标签 返回: 成功 示例:  | |
| 单次检查允许的最大时间(以秒为单位) 返回: 当 state != absent 时成功 示例:  | |
| 健康检查的类型 返回: 当 state != absent 时成功 | |
| 池成员的 monitor_status 变为 “up” 之前需要成功的检查次数 返回: 当 state != absent 时成功 示例:  | |
| 此负载均衡器健康检查的唯一标识符 返回: 成功 示例:  | 
