[FEED] Downtime cannot be changed
Describe the bug When patching servers with ansible we set a quite long downtime in Checkmk. After the patching is done we would like to reduce the downtime window instead of removing it for auditing purpose.
Trying to do this with the ansible collection does not work: setting the endtime via the downtime module does not change the downtime.
Component Name Component Name: downtime
Ansible Version This is from a test wsl installation in Ubuntu 22.04. The issue is also present for different ansible versions
$ ansible --version
ansible 2.10.8
config file = None
configured module search path = ['/home/stefan/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]
Checkmk Version and Edition
Checkmk Raw Edition 2.3.0p18
Collection Version
checkmk.general:5.3.0
To Reproduce Steps to reproduce the behavior:
- Set downtime
- Try to change end_after or end_time
- See that downtime has not changed
Expected behavior When a new endtime is set it should be changed
Actual behavior Nothing changes
Minimum reproduction example
---
- name: "Test Downtimes"
hosts: all
connection: local
gather_facts: false
vars:
checkmk_var_server_url: "http://localhost:8080"
checkmk_var_automation_user: "cmkadmin"
checkmk_var_automation_secret: "..."
mysite: "cmk"
tasks:
- name: "Set Downtime"
checkmk.general.downtime:
comment: "Downtime to be changed"
server_url: "{{ checkmk_var_server_url }}"
site: "{{ mysite }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
host_name: "{{ inventory_hostname }}"
end_after:
hours: 2
- name: "Change Downtime"
checkmk.general.downtime:
comment: "Downtime to be changed"
server_url: "{{ checkmk_var_server_url }}"
site: "{{ mysite }}"
automation_user: "{{ checkmk_var_automation_user }}"
automation_secret: "{{ checkmk_var_automation_secret }}"
host_name: "{{ inventory_hostname }}"
end_after:
minutes: 1
Running this playbook already shows the second task does nothing:
$ ansible-playbook -i 'demo.example.com,' test-downtimes.yml
PLAY [Test Downtimes] **************************************************************************************
TASK [Set Downtime] ****************************************************************************************
changed: [demo.example.com]
TASK [Change Downtime] *************************************************************************************
ok: [demo.example.com]
PLAY RECAP *************************************************************************************************
demo.example.com : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Hi @mayrstefan and thanks for reporting this! I can reproduce the issue and we will look into it.
As a workaround, you could use flexible downtimes or delete and re-add the downtime.
Hi @mayrstefan, the current downtime module doesn't support changing existing downtimes.
Implementing the possibility to change existing downtimes needs a lot of code change. As the code of this module is quite old, I decided to overhaul it in general and implement your feature request, then.
Until this happens, you can use the workaround described by Robin.
This issue has been stale for 60 days. It will close in 7 days.
I did a complete rework of the downtime module, but I need some more time to finish it.
This issue has been stale for 60 days. It will close in 7 days.
Any estimates when we will see the update downtime module?
Since writing my above comment, I haven't found any time to continue my work here. :-( Hope I will be able to finish my work shortly before or after the conference.
This issue has been stale for 60 days. It will close in 7 days.
The conference was three weeks ago. We should keep this ticket alive.
This issue has been stale for 60 days. It will close in 7 days.
This issue has been stale for 60 days. It will close in 7 days.