community.general.icinga2_downtime module – Manages Icinga 2 downtimes
Note
This module is part of the community.general collection (version 12.6.1).
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.
To use it in a playbook, specify: community.general.icinga2_downtime.
New in community.general 12.4.0
Synopsis
- Manages downtimes in Icinga 2 through its REST API.
- Options as described at https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#schedule-downtime.
Parameters
Parameter | Comments |
|---|---|
all_services boolean | Whether downtimes should be created for all services of the matched host objects. If omitted, Icinga 2 does not create downtimes for all services of the matched host objects by default. Choices:
|
author string | Name of the author. Default: |
ca_path path | CA certificates bundle to use to verify the Icinga 2 server certificate. |
child_options string | Schedule child downtimes. Choices:
|
client_cert path | PEM formatted certificate chain file to be used for SSL client authentication. This file can also include the key as well, and if the key is included, |
client_key path | PEM formatted file that contains your private key to be used for SSL client authentication. If |
comment string | A descriptive comment. Default: |
duration integer | Duration of the downtime. Required in case of a flexible downtime. |
end_time integer | End time of the downtime as UNIX timestamp. |
filter string | Filter expression limiting the objects to operate on. |
filter_vars dictionary | Variable names and values used in the filter expression. |
fixed boolean | Whether the downtime is fixed or flexible. If omitted, Icinga 2 creates a fixed downtime by default. Choices:
|
force boolean | If Choices:
|
force_basic_auth boolean | Credentials specified with Choices:
|
http_agent string | Header to identify as, generally appears in web server logs. Default: |
name string | Name of the downtime object. This option has no effect for states other than |
object_type string | Use Use Choices:
|
start_time integer | Start time of the downtime as UNIX timestamp. |
state string | State of the downtime. Choices:
|
timeout integer | How long to wait for the server to send data before giving up. Default: |
trigger_name string | Name of the downtime trigger. |
url string / required | URL of the Icinga 2 REST API. |
url_password string | The password for use in HTTP basic authentication. If the |
url_username string | The username for use in HTTP basic authentication. This parameter can be used without |
use_gssapi boolean added in ansible-core 2.11 | Use GSSAPI to perform the authentication, typically this is for Kerberos or Kerberos through Negotiate authentication. Requires the Python library gssapi to be installed. Credentials for GSSAPI can be specified with NTLM authentication is not supported even if the GSSAPI mech for NTLM has been installed. Choices:
|
use_proxy boolean | If Choices:
|
validate_certs boolean | If This should only be used on personally controlled sites using self-signed certificates. Choices:
|
Attributes
Attribute | Support | Description |
|---|---|---|
check_mode | Support: none In case of a complex filter expression, it may become very complex to decide whether downtime creation or removal will succeed and trigger a change. | Can run in |
diff_mode | Support: none | Returns details on what has changed (or possibly needs changing in |
Examples
- name: Schedule a host downtime
community.general.icinga2_downtime:
url: "https://icinga2.example.com:5665"
url_username: icingadmin
url_password: secret
state: present
author: Ansible
comment: Scheduled downtime for test purposes.
all_services: true
start_time: "{{ downtime_start_time }}"
end_time: "{{ downtime_end_time }}"
duration: "{{ downtime_duration }}"
fixed: true
object_type: Host
filter: host.name=="host.example.com"
delegate_to: localhost
register: icinga2_downtime_response
vars:
downtime_start_time: "{{ ansible_date_time['epoch'] | int }}"
downtime_end_time: "{{ downtime_start_time | int + 3600 }}"
downtime_duration: "{{ downtime_end_time | int - downtime_start_time | int }}"
- name: Remove scheduled host downtime
community.general.icinga2_downtime:
url: "https://icinga2.example.com:5665"
url_username: icingadmin
url_password: secret
state: absent
author: Ansible
object_type: Downtime
name: "{{ icinga2_downtime_response.results[0].name }}"
delegate_to: localhost
when: icinga2_downtime_response.results | default([]) | length > 0
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
error dictionary | Error message as JSON dictionary returned from the Icinga 2 API. Returned: if downtime scheduling or removal did not succeed Sample: |
results list / elements=dictionary | Results of downtime scheduling or removal Returned: success Sample: |
|
code integer |
Success or error code of downtime scheduling. Returned: always Sample: |
|
legacy_id integer |
Legacy id of the downtime object. Returned: if a downtime was scheduled successfully Sample: |
|
name string |
Name of the downtime object. Returned: if a downtime was scheduled successfully Sample: |
|
status string |
Human-readable message describing the result of downtime scheduling. Returned: always Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/community/general/icinga2_downtime_module.html