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

Trigger, acknowledge or resolve PagerDuty incidents

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

Authors: Amanpreet Singh (@ApsOps)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module will let you trigger, acknowledge or resolve a PagerDuty incident by sending events


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Trigger an incident with just the basic options
- pagerduty_alert:
    name: companyabc
    integration_key: xxx
    api_key: yourapikey
    service_id: PDservice
    state: triggered
    desc: problem that led to this trigger
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Trigger an incident with more options
- pagerduty_alert:
    integration_key: xxx
    api_key: yourapikey
    service_id: PDservice
    state: triggered
    desc: problem that led to this trigger
    incident_key: somekey
    client: Sample Monitoring Service
    client_url: http://service.example.com
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Acknowledge an incident based on incident_key
- pagerduty_alert:
    integration_key: xxx
    api_key: yourapikey
    service_id: PDservice
    state: acknowledged
    incident_key: somekey
    desc: "some text for incident's log"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Resolve an incident based on incident_key
- pagerduty_alert:
    integration_key: xxx
    api_key: yourapikey
    service_id: PDservice
    state: resolved
    incident_key: somekey
    desc: "some text for incident's log"

Inputs

    
desc:
    default: Created via Ansible
    description:
    - For C(triggered) I(state) - Required. Short description of the problem that led
      to this trigger. This field (or a truncated version) will be used when generating
      phone calls, SMS messages and alert emails. It will also appear on the incidents
      tables in the PagerDuty UI. The maximum length is 1024 characters.
    - For C(acknowledged) or C(resolved) I(state) - Text that will appear in the incident's
      log associated with this event.
    required: false

name:
    description:
    - PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API.

state:
    choices:
    - triggered
    - acknowledged
    - resolved
    description:
    - Type of event to be sent.
    required: true

client:
    description:
    - The name of the monitoring client that is triggering this event.
    required: false

api_key:
    description:
    - The pagerduty API key (readonly access), generated on the pagerduty site.
    required: true

client_url:
    description:
    - The URL of the monitoring client that is triggering this event.
    required: false

service_id:
    description:
    - ID of PagerDuty service when incidents will be triggered, acknowledged or resolved.
    required: true
    version_added: '2.7'
    version_added_collection: ansible.builtin

service_key:
    description:
    - The GUID of one of your "Generic API" services. Obsolete. Please use I(integration_key).

incident_key:
    description:
    - Identifies the incident to which this I(state) should be applied.
    - For C(triggered) I(state) - If there's no open (i.e. unresolved) incident with this
      key, a new one will be created. If there's already an open incident with a matching
      key, this event will be appended to that incident's log. The event key provides
      an easy way to "de-dup" problem reports.
    - For C(acknowledged) or C(resolved) I(state) - This should be the incident_key you
      received back when the incident was first opened by a trigger event. Acknowledge
      events referencing resolved or nonexistent incidents will be discarded.
    required: false
    version_added: '2.7'
    version_added_collection: ansible.builtin

integration_key:
    description:
    - The GUID of one of your "Generic API" services.
    - This is the "integration key" listed on a "Integrations" tab of PagerDuty service.
    required: true
    version_added: '2.7'
    version_added_collection: ansible.builtin