community.elastic.elastic_cluster_health (1.1.2) — module

Validate cluster health.

| "added in version" 0.0.1 of community.elastic"

Authors: Rhys Campbell (@rhysmeister)

Install collection

Install with ansible-galaxy collection install community.elastic:==1.1.2


Add to requirements.yml

  collections:
    - name: community.elastic
      version: 1.1.2

Description

Validate cluster health.

Optionally wait for an expected status.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Validate cluster health
  community.elastic.elastic_cluster_health:
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure cluster health status is green with 90 seconds timeout
  community.elastic.elastic_cluster_health:
    wait_for_status: "green"
    timeout: 90
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Ensure at least 10 nodes are up with 2m timeout
  community.elastic.elastic_cluster_health:
    wait_for_nodes: ">=10"
    timeout: 2m

Inputs

    
poll:
    default: 3
    description:
    - The maximum number of times to query for the replicaset status before the set converges
      or we fail.
    type: int

level:
    choices:
    - cluster
    - indices
    - shards
    default: cluster
    description:
    - Controls the details level of the health information returned
    type: str

local:
    default: false
    description:
    - If true, the request retrieves information from the local node only.
    - Defaults to false, which means information is retrieved from the master node.
    type: bool

to_be:
    description:
    - Used in conjunction with wait_for.
    - Expected value of the wait_for variable
    type: str

cafile:
    description:
    - Path to ca file
    type: str

status:
    choices:
    - green
    - yellow
    - red
    default: green
    description:
    - Expected status of the cluster changes to the one provided or better, i.e. green
      > yellow > red.
    type: str

timeout:
    default: 30
    description:
    - Response timeout in seconds.
    type: int

interval:
    default: 10
    description:
    - The number of seconds to wait between polling executions.
    type: int

wait_for:
    choices:
    - status
    - number_of_nodes
    - number_of_data_nodes
    - active_primary_shards
    - active_shards
    - relocating_shards
    - initializing_shards
    - unassigned_shards
    - delayed_unassigned_shards
    - number_of_pending_tasks
    - number_of_in_flight_fetch
    - task_max_waiting_in_queue_millis
    - active_shards_percent_as_number
    description:
    - Wait for the specific variable to reach a specific figure.
    - Provide the name of the variable returned by cluster health API.
    - https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-health.html
    type: str

login_port:
    default: 9200
    description:
    - The Elastic server port to login to.
    required: false
    type: int

login_user:
    description:
    - The Elastic user to login with.
    - Required when I(login_password) is specified.
    required: false
    type: str

auth_method:
    choices:
    - ''
    - http_auth
    default: ''
    description:
    - Authentication Method.
    type: str

auth_scheme:
    choices:
    - http
    - https
    default: http
    description:
    - Authentication scheme.
    type: str

login_hosts:
    default: localhost
    description:
    - The Elastic hosts to connect to.
    elements: str
    required: false
    type: list

login_password:
    description:
    - The password used to authenticate with.
    - Required when I(login_user) is specified.
    required: false
    type: str

fail_on_exception:
    default: false
    description:
    - Fail immediately on exception rather than retrying.
    type: bool

connection_options:
    default: []
    description:
    - Additional connection options for Elasticsearch
    elements: dict
    type: list