cloudscale_ch.cloud.load_balancer_health_monitor (2.3.1) — module

Manages load balancers on the cloudscale.ch IaaS service

| "added in version" 2.3.0 of cloudscale_ch.cloud"

Authors: Gaudenz Steinlin (@gaudenz), Kenneth Joss (@k-304)

Install collection

Install with ansible-galaxy collection install cloudscale_ch.cloud:==2.3.1


Add to requirements.yml

  collections:
    - name: cloudscale_ch.cloud
      version: 2.3.1

Description

Get, create, update, delete health monitors on the cloudscale.ch IaaS service.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# 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

Inputs

    
http:
    description:
    - Advanced options for health monitors with type "http" or "https".
    suboptions:
      expected_codes:
        description:
        - The HTTP status codes allowed for a check to be considered successful.
        - See the [API documentation](https://www.cloudscale.ch/en/api/v1#http-attribute-specification)
          for details.
        elements: str
        type: list
      host:
        description:
        - The server name in the HTTP Host header used for the check.
        - Requires version to be set to "1.1".
        type: str
      method:
        description:
        - The HTTP method used for the check.
        type: str
      url_path:
        description:
        - The URL used for the check.
        type: str
      version:
        description:
        - The HTTP version used for the check.
        type: str
    type: dict

pool:
    description:
    - The pool of the health monitor.
    type: str

tags:
    description:
    - Tags assosiated with the load balancer. Set this to C({}) to clear any tags.
    type: dict

type:
    description:
    - The type of the health monitor.
    - See the [API documentation](https://www.cloudscale.ch/en/api/v1#create-a-health-monitor)
      for allowed options.
    type: str

uuid:
    description:
    - UUID of the load balancer health monitor.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the load balancer health monitor.
    type: str

api_url:
    default: https://api.cloudscale.ch/v1
    description:
    - cloudscale.ch API URL.
    - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

delay_s:
    description:
    - The delay between two successive checks in seconds.
    type: int

api_token:
    description:
    - cloudscale.ch API token.
    - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable.
    required: true
    type: str

timeout_s:
    description:
    - The maximum time allowed for an individual check in seconds.
    type: int

api_timeout:
    default: 45
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable.
    type: int

up_threshold:
    description:
    - The number of checks that need to be successful before the monitor_status of a pool
      member changes to "up".
    type: int

down_threshold:
    description:
    - The number of checks that need to fail before the monitor_status of a pool member
      changes to "down".
    type: int

Outputs

created_at:
  description: The creation date and time of the load balancer health monitor
  returned: success when not state == absent
  sample: '2023-02-22T09:55:38.285018Z'
  type: str
delay_s:
  description: The delay between two successive checks in seconds
  returned: success when not state == absent
  sample: 2
  type: int
down_threshold:
  description: The number of checks that need to fail before the monitor_status of
    a pool member changes to "down"
  returned: success when not state == absent
  sample: 3
  type: int
href:
  description: API URL to get details about this load balancer health monitor
  returned: success when not state == absent
  sample: https://api.cloudscale.ch/v1/load-balancers/health-monitors/ee4952d4-2eba-4dec-8957-7911b3ce245b
  type: str
http:
  description: Advanced options for health monitors with type "http" or "https"
  returned: success when not state == absent
  sample:
  - expected_codes:
    - '200'
    host: null
    method: GET
    url_path: /
    version: '1.0'
  type: dict
pool:
  description: The pool of the health monitor
  returned: success when not state == absent
  sample:
  - href: https://api.cloudscale.ch/v1/load-balancers/pools/618a6cc8-d757-4fab-aa10-d49dc47e667b
  - uuid: 618a6cc8-d757-4fab-aa10-d49dc47e667b
  - name: swimming pool
  type: dict
tags:
  description: Tags assosiated with the load balancer
  returned: success
  sample:
    project: my project
  type: dict
timeout_s:
  description: The maximum time allowed for an individual check in seconds
  returned: success when not state == absent
  sample: 1
  type: int
type:
  description: The type of the health monitor
  returned: success when not state == absent
  type: str
up_threshold:
  description: The number of checks that need to be successful before the monitor_status
    of a pool member changes to "up"
  returned: success when not state == absent
  sample: 2
  type: int
uuid:
  description: The unique identifier for this load balancer health monitor
  returned: success
  sample: ee4952d4-2eba-4dec-8957-7911b3ce245b
  type: str