community / community.general / 1.3.11 / module / pagerduty Create PagerDuty maintenance windows Authors: Andrew Newdigate (@suprememoocow), Dylan Silva (@thaumos), Justin Johns (!UNKNOWN), Bruce Pennypacker (@bpennypacker)community.general.pagerduty (1.3.11) — module
Install with ansible-galaxy collection install community.general:==1.3.11
collections: - name: community.general version: 1.3.11
This module will let you create PagerDuty maintenance windows
- name: List ongoing maintenance windows using a token community.general.pagerduty: name: companyabc token: xxxxxxxxxxxxxx state: ongoing
- 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
- 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
- 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
- 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 }}'
# 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
- name: Delete community.general.pagerduty: requester_id: XXXXXXX token: yourtoken state: absent window_id: "{{ pd_window.result.maintenance_windows[0].id }}"
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 I(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: '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