community.general.pagerduty_alert – Trigger, acknowledge or resolve PagerDuty incidents
Note
This plugin is part of the community.general collection (version 3.8.3).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.pagerduty_alert
.
Synopsis
This module will let you trigger, acknowledge or resolve a PagerDuty incident by sending events
Requirements
The below requirements are needed on the host that executes this module.
PagerDuty API access
Parameters
Parameter |
Comments |
---|---|
The pagerduty API key (readonly access), generated on the pagerduty site. |
|
The name of the monitoring client that is triggering this event. |
|
The URL of the monitoring client that is triggering this event. |
|
For For Default: “Created via Ansible” |
|
Identifies the incident to which this state should be applied. For For |
|
The GUID of one of your “Generic API” services. This is the “integration key” listed on a “Integrations” tab of PagerDuty service. |
|
PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API. |
|
ID of PagerDuty service when incidents will be triggered, acknowledged or resolved. |
|
The GUID of one of your “Generic API” services. Obsolete. Please use integration_key. |
|
Type of event to be sent. Choices:
|
Examples
- name: Trigger an incident with just the basic options
community.general.pagerduty_alert:
name: companyabc
integration_key: xxx
api_key: yourapikey
service_id: PDservice
state: triggered
desc: problem that led to this trigger
- name: Trigger an incident with more options
community.general.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
- name: Acknowledge an incident based on incident_key
community.general.pagerduty_alert:
integration_key: xxx
api_key: yourapikey
service_id: PDservice
state: acknowledged
incident_key: somekey
desc: "some text for incident's log"
- name: Resolve an incident based on incident_key
community.general.pagerduty_alert:
integration_key: xxx
api_key: yourapikey
service_id: PDservice
state: resolved
incident_key: somekey
desc: "some text for incident's log"
Authors
Amanpreet Singh (@ApsOps)