Deprecated

Removed in 2.0.0

i

Reason:Updated modules released with increased functionality | Alternative:Use M(google.cloud.gcp_compute_health_check), M(google.cloud.gcp_compute_http_health_check) or M(google.cloud.gcp_compute_https_health_check) instead.

community.general.gcp_healthcheck (1.3.14) — module

Create, Update or Destroy a Healthcheck.

Authors: Tom Melendez (@supertom) <tom@supertom.com>

Install collection

Install with ansible-galaxy collection install community.general:==1.3.14


Add to requirements.yml

  collections:
    - name: community.general
      version: 1.3.14

Description

Create, Update or Destroy a Healthcheck. Currently only HTTP and HTTPS Healthchecks are supported. Healthchecks are used to monitor individual instances, managed instance groups and/or backend services. Healtchecks are reusable.

Visit U(https://cloud.google.com/compute/docs/load-balancing/health-checks) for an overview of Healthchecks on GCP.

See U(https://cloud.google.com/compute/docs/reference/latest/httpHealthChecks) for API details on HTTP Healthchecks.

See U(https://cloud.google.com/compute/docs/reference/latest/httpsHealthChecks) for more details on the HTTPS Healtcheck API.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create Minimum HealthCheck
  community.general.gcp_healthcheck:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    healthcheck_name: my-healthcheck
    healthcheck_type: HTTP
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create HTTP HealthCheck
  community.general.gcp_healthcheck:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    healthcheck_name: my-healthcheck
    healthcheck_type: HTTP
    host: my-host
    request_path: /hc
    check_interval: 10
    timeout: 30
    unhealthy_threshhold: 2
    healthy_threshhold: 1
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create HTTPS HealthCheck
  community.general.gcp_healthcheck:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    healthcheck_name: "{{ https_healthcheck }}"
    healthcheck_type: HTTPS
    host_header: my-host
    request_path: /hc
    check_interval: 5
    timeout: 5
    unhealthy_threshold: 2
    healthy_threshold: 1
    state: present

Inputs

    
port:
    description:
    - The TCP port number for the health check request. The default value is 443 for HTTPS
      and 80 for HTTP.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description: State of the Healthcheck.
    type: str

timeout:
    default: 5
    description:
    - How long (in seconds) to wait for a response before claiming failure. It is invalid
      for timeout to have a greater value than check_interval.
    type: int

project_id:
    description:
    - Your GCP project ID
    type: str

host_header:
    default: ''
    description:
    - The value of the host header in the health check request. If left empty, the public
      IP on behalf of which this health check is performed will be used.
    type: str

request_path:
    default: /
    description:
    - The request path of the HTTPS health check request.
    required: false
    type: str

check_interval:
    default: 5
    description:
    - How often (in seconds) to send a health check.
    type: int

credentials_file:
    description:
    - Path to the JSON file associated with the service account email
    type: str

healthcheck_name:
    description:
    - Name of the Healthcheck.
    required: true
    type: str

healthcheck_type:
    choices:
    - HTTP
    - HTTPS
    description:
    - Type of Healthcheck.
    required: true
    type: str

healthy_threshold:
    default: 2
    description:
    - A so-far unhealthy instance will be marked healthy after this many consecutive successes.
    type: int

unhealthy_threshold:
    default: 2
    description:
    - A so-far healthy instance will be marked unhealthy after this many consecutive failures.
    type: int

service_account_email:
    description:
    - service account email
    type: str

service_account_permissions:
    description:
    - service account permissions (see U(https://cloud.google.com/sdk/gcloud/reference/compute/instances/create),
      --scopes section for detailed information)
    - 'Available choices are: C(bigquery), C(cloud-platform), C(compute-ro), C(compute-rw),
      C(useraccounts-ro), C(useraccounts-rw), C(datastore), C(logging-write), C(monitoring),
      C(sql-admin), C(storage-full), C(storage-ro), C(storage-rw), C(taskqueue), C(userinfo-email).

      '
    type: list

Outputs

healthcheck:
  description: GCP Healthcheck dictionary
  returned: Always. Refer to GCP documentation for detailed field descriptions.
  sample:
    name: my-hc
    port: 443
    requestPath: /foo
  type: dict
healthcheck_name:
  description: Name of the Healthcheck
  returned: Always
  sample: my-url-map
  type: str
healthcheck_type:
  description: Type of the Healthcheck
  returned: Always
  sample: HTTP
  type: str
state:
  description: state of the Healthcheck
  returned: Always.
  sample: present
  type: str