community.healthchecksio.checks (1.3.1) — module

Create, delete, update, and pause checks

| "added in version" 0.1.0 of community.healthchecksio"

Authors: Mark Mercado (@mamercad)

Install collection

Install with ansible-galaxy collection install community.healthchecksio:==1.3.1


Add to requirements.yml

  collections:
    - name: community.healthchecksio
      version: 1.3.1

Description

Creates a new check and returns its ping URL.

For C(state=absent), will delete the check with the given C(uuid).

For C(state=pause), will pause the check with the given C(uuid).

All request parameters are optional and will use their default values if omitted.

To create a Simple check, specify the C(timeout) parameter.

To create a Cron check, specify the C(schedule) and C(tz) parameters.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a Simple check named "test simple"
  community.healthchecksio.checks:
    state: present
    name: "test simple"
    desc: "my simple test check"
    unique: ["name"]
    tags: ["test", "simple"]
    timeout: 60
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a Cron check named "test hourly"
  community.healthchecksio.checks:
    state: present
    name: "test hourly"
    unique: ["name"]
    tags: ["test", "hourly"]
    desc: "my hourly test check"
    schedule: "0 * * * *"
    tz: UTC

Inputs

    
tz:
    description:
    - Server's timezone. This setting only has an effect in combination with the schedule
      parameter.
    required: false
    type: str

desc:
    default: ''
    description:
    - Description of the check.
    required: false
    type: str

name:
    default: ''
    description:
    - Name for the new check.
    required: false
    type: str

tags:
    default: []
    description:
    - Tags for the check.
    elements: str
    required: false
    type: list

uuid:
    default: ''
    description:
    - Check uuid to delete when state is C(absent) or C(pause).
    required: false
    type: str

grace:
    default: 3600
    description:
    - A number of seconds, the grace period for this check.
    required: false
    type: int

state:
    choices:
    - present
    - absent
    - pause
    default: present
    description:
    - C(present) will create or update a check.
    - C(absent) will delete a check.
    - C(pause) will pause a check.
    type: str

unique:
    default: []
    description:
    - Enables "upsert" functionality.
    - Before creating a check, Healthchecks.io looks for existing checks, filtered by
      fields listed in unique.
    - The accepted values for the unique field are C(name), C(tags), C(timeout), and C(grace).
    elements: str
    required: false
    type: list

methods:
    default: ''
    description:
    - Specifies the allowed HTTP methods for making ping requests.
    - Must be one of the two values "" (an empty string) or "POST".
    - Set this field to "" (an empty string) to allow HEAD, GET, and POST requests.
    - Set this field to "POST" to allow only POST requests.
    required: false
    type: str

timeout:
    description:
    - A number of seconds, the expected period of this check.
    - Minimum 60 (one minute), maximum 2592000 (30 days).
    required: false
    type: int

channels:
    default: ''
    description:
    - By default, this API call assigns no integrations to the newly created check.
    - Set this field to a special value "*" to automatically assign all existing integrations.
    - To assign specific integrations, use a comma-separated list of integration UUIDs.
    required: false
    type: str

schedule:
    description:
    - A cron expression defining this check's schedule.
    - If you specify both timeout and schedule parameters, Healthchecks.io will create
      a Cron check and ignore the timeout value.
    required: false
    type: str

api_token:
    aliases:
    - api_key
    description:
    - Healthchecks.io API token.
    - 'There are several environment variables which can be used to provide this value:'
    - C(HEALTHCHECKSIO_API_TOKEN), C(HEALTHCHECKSIO_API_KEY), C(HC_API_TOKEN), C(HC_API_KEY)
    required: true
    type: str

manual_resume:
    default: false
    description:
    - Controls whether a paused check automatically resumes when pinged (the default)
      or not.
    - If set to false, a paused check will leave the paused state when it receives a ping.
    - If set to true, a paused check will ignore pings and stay paused until you manually
      resume it from the web dashboard.
    required: false
    type: bool

Outputs

data:
  description: Create, update, pause or delete response
  returned: always
  sample:
    channels: ''
    desc: ''
    grace: 3600
    last_ping: null
    manual_resume: false
    methods: ''
    n_pings: 0
    name: test
    next_ping: null
    pause_url: https://healthchecks.io/api/v1/checks/524d0f69-0ff3-4120-a2e2-03ebd5736b25/pause
    ping_url: https://hc-ping.com/524d0f69-0ff3-4120-a2e2-03ebd5736b25
    schedule: '* * * * *'
    slug: test
    status: new
    tags: ''
    tz: UTC
    update_url: https://healthchecks.io/api/v1/checks/524d0f69-0ff3-4120-a2e2-03ebd5736b25
  type: dict
msg:
  description: Create, update, pause or delete message
  returned: always
  sample: New check 524d0f69-0ff3-4120-a2e2-03ebd5736b25 created
  type: str
uuid:
  description: Check UUID from create or update
  returned: changed
  sample: 524d0f69-0ff3-4120-a2e2-03ebd5736b25
  type: str