-
-
Save bodsch/fcabad20b0b2c4d094ca17a10f250bfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: schedule downtime | |
uri: | |
url: "https://{{ icinga_host }}:{{ icinga_port | default(5665) }}/v1/actions/schedule-downtime" | |
user: "{{ icinga_user }}" | |
password: "{{ icinga_password }}" | |
force_basic_auth: True | |
validate_certs: False | |
method: POST | |
headers: | |
Accept: "application/json" | |
body_format: json | |
body: | |
type: "{{ item.type }}" | |
filter: "{{ item.filter }}" | |
author: "ansible" | |
fixed: true | |
comment: "Downtime for firmware upgrade" | |
start_time : "{{ downtime_start }}" | |
end_time : "{{ downtime_end }}" | |
vars: | |
downtime_duration: 30 | |
downtime_start: "{{ ansible_date_time.epoch }}" | |
downtime_end: "{{ downtime_start | int + downtime_duration * 60 }}" | |
loop: | |
- { type: "Host", filter: "host.name==\"{{system_name}}-rtr\"" } | |
- { type: "Service", filter: "host.name==\"{{system_name}}-rtr\"" } | |
delegate_to: localhost | |
tags: | |
- monitoring | |
- name: remove downtime | |
uri: | |
url: "https://{{ icinga_host }}:{{ icinga_port | default(5665) }}/v1/actions/remove-downtime" | |
user: "{{ icinga_user }}" | |
password: "{{ icinga_password }}" | |
force_basic_auth: True | |
validate_certs: False | |
method: POST | |
headers: | |
Accept: "application/json" | |
body_format: json | |
body: | |
type: "Downtime" | |
filter: "host.name==\"{{system_name}}-rtr\" && downtime.author == \"ansible\"" | |
delegate_to: localhost | |
tags: | |
- monitoring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment