Deprecated

Removed in 2.12

i

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

ansible.builtin._gcp_healthcheck (v2.9.27) — module

Create, Update or Destroy a Healthcheck.

| "added in version" 2.4 of ansible.builtin"

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

deprecated | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

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
  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
  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
  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.

state:
    choices:
    - present
    - absent
    description: State of the Healthcheck.
    required: true

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.

project_id:
    description:
    - Your GCP project ID

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.
    required: true

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

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

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

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

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

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

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

service_account_email:
    description:
    - service account email

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

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