community.general.pagerduty (8.5.0) — module

Create PagerDuty maintenance windows

Authors: Andrew Newdigate (@suprememoocow), Dylan Silva (@thaumos), Justin Johns (!UNKNOWN), Bruce Pennypacker (@bpennypacker)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module will let you create PagerDuty maintenance windows


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List ongoing maintenance windows using a token
  community.general.pagerduty:
    name: companyabc
    token: xxxxxxxxxxxxxx
    state: ongoing
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a 1 hour maintenance window for service FOO123
  community.general.pagerduty:
    name: companyabc
    user: example@example.com
    token: yourtoken
    state: running
    service: FOO123
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a 5 minute maintenance window for service FOO123
  community.general.pagerduty:
    name: companyabc
    token: xxxxxxxxxxxxxx
    hours: 0
    minutes: 5
    state: running
    service: FOO123
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.

- name: Create a 4 hour maintenance window for service FOO123 with the description "deployment"
  community.general.pagerduty:
    name: companyabc
    user: example@example.com
    state: running
    service: FOO123
    hours: 4
    desc: deployment
  register: pd_window
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete the previous maintenance window
  community.general.pagerduty:
    name: companyabc
    user: example@example.com
    state: absent
    window_id: '{{ pd_window.result.maintenance_window.id }}'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Delete a maintenance window from a separate playbook than its creation,
# and if it is the only existing maintenance window
- name: Check
  community.general.pagerduty:
    requester_id: XXXXXXX
    token: yourtoken
    state: ongoing
  register: pd_window
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete
  community.general.pagerduty:
    requester_id: XXXXXXX
    token: yourtoken
    state: absent
    window_id: "{{ pd_window.result.maintenance_windows[0].id }}"

Inputs

    
desc:
    default: Created by Ansible
    description:
    - Short description of maintenance window.
    type: str

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

user:
    description:
    - PagerDuty user ID. Obsolete. Please, use O(token) for authorization.
    type: str

hours:
    default: '1'
    description:
    - Length of maintenance window in hours.
    type: str

state:
    choices:
    - running
    - started
    - ongoing
    - absent
    description:
    - Create a maintenance window or get a list of ongoing windows.
    required: true
    type: str

token:
    description:
    - A pagerduty token, generated on the pagerduty site. It is used for authorization.
    required: true
    type: str

minutes:
    default: '0'
    description:
    - Maintenance window in minutes (this is added to the hours).
    type: str

service:
    aliases:
    - services
    description:
    - A comma separated list of PagerDuty service IDs.
    elements: str
    type: list

window_id:
    description:
    - ID of maintenance window. Only needed when absent a maintenance_window.
    type: str

requester_id:
    description:
    - ID of user making the request. Only needed when creating a maintenance_window.
    type: str

validate_certs:
    default: true
    description:
    - If V(false), SSL certificates will not be validated. This should only be used on
      personally controlled sites using self-signed certificates.
    type: bool