community.general.datadog_downtime module – Manages Datadog downtimes
Note
This module is part of the community.general collection (version 8.6.7).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install community.general
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: community.general.datadog_downtime
.
New in community.general 2.0.0
Synopsis
Manages downtimes within Datadog.
Options as described on https://docs.datadoghq.com/api/v1/downtimes/.
Aliases: monitoring.datadog.datadog_downtime
Requirements
The below requirements are needed on the host that executes this module.
datadog-api-client
Python 3.6+
Parameters
Parameter |
Comments |
---|---|
The URL to the Datadog API. This value can also be set with the Default: |
|
Your Datadog API key. |
|
Your Datadog app key. |
|
A message to include with notifications for this downtime. Email notifications can be sent to specific users by using the same “@username” notation as events. |
|
POSIX timestamp to end the downtime. If not provided, the downtime is in effect until you cancel it. |
|
The identifier of the downtime. If empty, a new downtime gets created, otherwise it is either updated or deleted depending of the To keep your playbook idempotent, you should save the identifier in a file and read it in a lookup. |
|
The ID of the monitor to mute. If not provided, the downtime applies to all monitors. |
|
A list of monitor tags to which the downtime applies. The resulting downtime applies to monitors that match ALL provided monitor tags. |
|
The For example, to have a recurring event on the first day of each month, select a type of rrule and set the Most common rrule options from the iCalendar Spec are supported. Attributes specifying the duration in |
|
A list of scopes to which the downtime applies. The resulting downtime applies to sources that matches ALL provided scopes. |
|
POSIX timestamp to start the downtime. If not provided, the downtime starts the moment it is created. |
|
The designated state of the downtime. Choices:
|
|
The timezone for the downtime. |
Attributes
Attribute |
Support |
Description |
---|---|---|
Support: none |
Can run in |
|
Support: none |
Will return details on what has changed (or possibly needs changing in |
Examples
- name: Create a downtime
register: downtime_var
community.general.datadog_downtime:
state: present
monitor_tags:
- "foo:bar"
downtime_message: "Downtime for foo:bar"
scope: "test"
api_key: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
app_key: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
# Lookup the id in the file and ignore errors if the file doesn't exits, so downtime gets created
id: "{{ lookup('file', inventory_hostname ~ '_downtime_id.txt', errors='ignore') }}"
- name: Save downtime id to file for later updates and idempotence
delegate_to: localhost
copy:
content: "{{ downtime.downtime.id }}"
dest: "{{ inventory_hostname ~ '_downtime_id.txt' }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The downtime returned by the API. Returned: always Sample: |