Documentation

pagerduty - Create PagerDuty maintenance windows

Synopsis

  • This module will let you create PagerDuty maintenance windows

Requirements

The below requirements are needed on the host that executes this module.

  • PagerDuty API access

Parameters

Parameter
Choices/Defaults
Comments
desc
Default:
Created by Ansible
Short description of maintenance window.
hours
Default:
yes
Length of maintenance window in hours.
minutes
(added in 1.8)
Default:
no
Maintenance window in minutes (this is added to the hours).
name
required
PagerDuty unique subdomain.
passwd
required
PagerDuty user password.
requester_id
required

(added in 1.8)
ID of user making the request. Only needed when using a token and creating a maintenance_window.
service
A comma separated list of PagerDuty service IDs.

aliases: services
state
required
    Choices:
  • running
  • started
  • ongoing
  • absent
Create a maintenance window or get a list of ongoing windows.
token
required

(added in 1.8)
A pagerduty token, generated on the pagerduty site. Can be used instead of user/passwd combination.
user
required
PagerDuty user ID.
validate_certs
(added in 1.5.1)
    Choices:
  • no
  • yes ←
If no, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

Examples

# List ongoing maintenance windows using a user/passwd
- pagerduty:
    name: companyabc
    user: example@example.com
    passwd: password123
    state: ongoing

# List ongoing maintenance windows using a token
- pagerduty:
    name: companyabc
    token: xxxxxxxxxxxxxx
    state: ongoing

# Create a 1 hour maintenance window for service FOO123, using a user/passwd
- pagerduty:
    name: companyabc
    user: example@example.com
    passwd: password123
    state: running
    service: FOO123

# Create a 5 minute maintenance window for service FOO123, using a token
- pagerduty:
    name: companyabc
    token: xxxxxxxxxxxxxx
    hours: 0
    minutes: 5
    state: running
    service: FOO123


# Create a 4 hour maintenance window for service FOO123 with the description "deployment".
- pagerduty:
    name: companyabc
    user: example@example.com
    passwd: password123
    state: running
    service: FOO123
    hours: 4
    desc: deployment
  register: pd_window

# Delete the previous maintenance window
- pagerduty:
    name: companyabc
    user: example@example.com
    passwd: password123
    state: absent
    service: '{{ pd_window.result.maintenance_window.id }}'

Status

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

Author

  • Andrew Newdigate (@suprememoocow)
  • Dylan Silva (@thaumos)
  • Justin Johns
  • Bruce Pennypacker

Hint

If you notice any issues in this documentation you can edit this document to improve it.