Documentation

pagerduty_alert - Trigger, acknowledge or resolve PagerDuty incidents

New in version 1.9.

Synopsis

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

Options

parameter required default choices comments
api_key
yes
The pagerduty API key (readonly access), generated on the pagerduty site.
client
no
The name of the monitoring client that is triggering this event.
client_url
no
The URL of the monitoring client that is triggering this event.
desc
no Created via Ansible
For triggered 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 acknowledged or resolved state - Text that will appear in the incident's log associated with this event.
incident_key
no
Identifies the incident to which this state should be applied.
For triggered 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 acknowledged or resolved 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.
name
yes
PagerDuty unique subdomain.
service_key
yes
The GUID of one of your "Generic API" services.
This is the "service key" listed on a Generic API's service detail page.
state
yes
  • triggered
  • acknowledged
  • resolved
Type of event to be sent.

Examples

# Trigger an incident with just the basic options
- pagerduty_alert:
    name: companyabc
    service_key: xxx
    api_key: yourapikey
    state: triggered
    desc: problem that led to this trigger

# Trigger an incident with more options
- pagerduty_alert:
    service_key: xxx
    api_key: yourapikey
    state: triggered
    desc: problem that led to this trigger
    incident_key: somekey
    client: Sample Monitoring Service
    client_url: http://service.example.com

# Acknowledge an incident based on incident_key
- pagerduty_alert:
    service_key: xxx
    api_key: yourapikey
    state: acknowledged
    incident_key: somekey
    desc: "some text for incident's log"

# Resolve an incident based on incident_key
- pagerduty_alert:
    service_key: xxx
    api_key: yourapikey
    state: resolved
    incident_key: somekey
    desc: "some text for incident's log"

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.