community / community.general / 0.1.4 / module / pagerduty Create PagerDuty maintenance windows Authors: Andrew Newdigate (@suprememoocow), Dylan Silva (@thaumos), Justin Johns (!UNKNOWN), Bruce Pennypacker (@bpennypacker)community.general.pagerduty (0.1.4) — module
Install with ansible-galaxy collection install community.general:==0.1.4
collections: - name: community.general version: 0.1.4
This module will let you create PagerDuty maintenance windows
- name: List ongoing maintenance windows using a token pagerduty: name: companyabc token: xxxxxxxxxxxxxx state: ongoing
- name: Create a 1 hour maintenance window for service FOO123 pagerduty: name: companyabc user: example@example.com token: yourtoken state: running service: FOO123
- name: Create a 5 minute maintenance window for service FOO123 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" pagerduty: name: companyabc user: example@example.com state: running service: FOO123 hours: 4 desc: deployment register: pd_window
- name: Delete the previous maintenance window 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 pagerduty: requester_id: XXXXXXX token: yourtoken state: ongoing register: pd_window
- name: Delete 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. 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 minutes: default: 0 description: - Maintenance window in minutes (this is added to the hours). 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. requester_id: description: - ID of user making the request. Only needed when creating a maintenance_window. 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