Hi there,
I have a playbook that updates my Checkmk installation to the latest version and deploys the latest agents to all my hosts. I download and install the latest server version like this:
---
- name: update check_mk server
hosts: localhost
gather_facts: no
tasks:
- name: download latest check_mk server package
ansible.builtin.get_url:
url: https://download.checkmk.com/checkmk/2.1.0b7/check-mk-raw-2.1.0b7-sles15sp3-38.x86_64.rpm
dest: /tmp/check-mk-raw-latest.x86_64.rpm
register: new_server
- name: install latest check_mk server package
ansible.builtin.package:
name: /tmp/check-mk-raw-latest.x86_64.rpm
state: present
disable_gpg_check: yes
when: new_server.changed
- name: stop site
ansible.builtin.command: omd stop home
when: new_server.changed
- name: update site
ansible.builtin.command: omd -f -V 2.1.0b7.cre update --conflict=install home
when: new_server.changed
- name: start site
ansible.builtin.command: omd start home
when: new_server.changed
I’m looking for a way to automatically grab the latest version (beta if available, stable otherwise) rather than having to edit that URL each time I want to run my playbook. I look at parsing the code behind Download archive of outdated Checkmk versions or Download Checkmk for free | Checkmk but this is incredibly complicated due to how the download link is dynamically generated. There must be a better way?