New in version 2.4.
| parameter | required | default | choices | comments |
|---|---|---|---|---|
| check_interval | no | 5 | How often (in seconds) to send a health check. | |
| credentials_file | no | Path to the JSON file associated with the service account email | ||
| healthcheck_name | yes | Name of the Healthcheck. | ||
| healthcheck_type | yes |
| Type of Healthcheck. | |
| healthy_threshold | no | 2 | A so-far unhealthy instance will be marked healthy after this many consecutive successes. | |
| host_header | yes | 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. | ||
| port | no | The TCP port number for the health check request. The default value is 443 for HTTPS and 80 for HTTP. | ||
| project_id | no | Your GCP project ID | ||
| request_path | no | / | The request path of the HTTPS health check request. | |
| service_account_email | no | service account email | ||
| service_account_permissions (added in 2.0)
| no |
| service account permissions (see https://cloud.google.com/sdk/gcloud/reference/compute/instances/create, --scopes section for detailed information) | |
| state | yes |
| State of the Healthcheck. | |
| timeout | no | 5 | 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. | |
| unhealthy_threshold | no | 2 | A so-far healthy instance will be marked unhealthy after this many consecutive failures. |
- 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
- 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
- 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
Common return values are documented here Return Values, the following are the fields unique to this module:
| name | description | returned | type | sample |
|---|---|---|---|---|
| healthcheck_name | Name of the Healthcheck | Always | str | my-url-map |
| healthcheck_type | Type of the Healthcheck | Always | str | HTTP |
| state | state of the Healthcheck | Always. | str | present |
| healthcheck | GCP Healthcheck dictionary | Always. Refer to GCP documentation for detailed field descriptions. | dict | {'port': 443, 'requestPath': '/foo', 'name': 'my-hc'} |
Note
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/gcp_healthcheck_module.html