ansible-checkmk icon indicating copy to clipboard operation
ansible-checkmk copied to clipboard

repeated activation in cmk_host_registration

Open FloMiau opened this issue 4 years ago • 2 comments

Hey there,

I'm a bit confused about the cmk_host_registration role.

The checkmk_host module includes the parameter "activate_changes" which defaults to true and starts the activation after a change.

If the tasks returns with a change the handler "activate changes" which also starts the activation.

There should be a recommendation for which way to use and there should be no doubled activation.

Thanks. Flo

FloMiau avatar Jan 05 '21 17:01 FloMiau

Hi @FloMiau,

sorry for the late answer. Even if I did not take a closer look into your problem, I'm aware of many problems in the current implementation of the Checkmk API. It's currently missing a well working client. The current one is just a workaround. Additionally, the current implementation will need to support both Web- and Rest-API.

Because of that, it's unlikely that I will have time to fix that, soon. :/

godspeed-you avatar Aug 19 '21 14:08 godspeed-you

I'll go further... the cmk_host_registration : Add host task (which calls checkmk_host) in the cmk_host_registration role always shows an Ansible change - even if the host in question is already in CheckMK. The handler then also runs to "apply changes", but correctly identifies that no changes are required (and doesn't report an Ansible change).

My guess is the checkmk_host code should ask CheckMK about the host first - if not found, or the details of the host differ from those to be applied, then make the REST call to add the host (and report an Ansible change). Otherwise don't bother with any further communications and don't return an Ansible change. That will avoid the handler wanting to run too.

I can understand if this is too tricky to do with the current implementation, but without it, it makes these roles less useful than they could otherwise be.

coofercat avatar Dec 10 '21 14:12 coofercat

As this project was just deprecated, I will close this issue in preparation of the archival. Head over to our Ansible Collection and check it out! :)

robin-checkmk avatar Sep 02 '22 12:09 robin-checkmk