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

Create PagerDuty maintenance windows

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

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

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module will let you create PagerDuty maintenance windows


Requirements

Usage examples

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

# Create a 4 hour maintenance window for service FOO123 with the description "deployment".
- 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.
# Delete the previous maintenance window
- 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.
- pagerduty:
    requester_id: XXXXXXX
    token: yourtoken
    state: ongoing
  register: pd_window
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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.

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

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

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

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

token:
    description:
    - A pagerduty token, generated on the pagerduty site. It is used for authorization.
    required: true
    version_added: '1.8'
    version_added_collection: ansible.builtin

minutes:
    default: 0
    description:
    - Maintenance window in minutes (this is added to the hours).
    version_added: '1.8'
    version_added_collection: ansible.builtin

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

window_id:
    description:
    - ID of maintenance window. Only needed when absent a maintenance_window.
    version_added: '2.7'
    version_added_collection: ansible.builtin

requester_id:
    description:
    - ID of user making the request. Only needed when creating a maintenance_window.
    version_added: '1.8'
    version_added_collection: ansible.builtin

validate_certs:
    default: 'yes'
    description:
    - If C(no), SSL certificates will not be validated. This should only be used on personally
      controlled sites using self-signed certificates.
    type: bool
    version_added: 1.5.1
    version_added_collection: ansible.builtin