How to download latest version of MK programatically

I do a similar thing with the agent installation. My solution includes an internally available HTTP folder containing the agent files, and a symlink called “agent-latest.rpm” which I point at the new files when I generate them. You could do a similar thing - download it once, put it in a shared location called “checkmk-server-latest.rpm” and reference that in your playbook.

Not totally automatic like you asked, but probably much safer. Checkmk generally dislikes having different versions running within a distributed setup, if a new version were to be released in between you doing updates/installations of different hosts you might find yourself in a pickle.

You could also solve this in the opposite way. Given that you need the version number several times in the playbook, look it up yourself and supply it as a variable.