Renew Checkmk agent certificates during updates

This commit is contained in:
Vincent Stuyck
2026-10-30 19:42:55 +01:00
parent 093589732e
commit a3d4e9b4fa
2 changed files with 19 additions and 2 deletions
+17
View File
@@ -91,9 +91,26 @@
- name: Update checkmk agents on monitored hosts
hosts: agents
become: true
vars:
checkmk_server: "{{ checkmk_api_url | urlsplit('hostname') }}"
tasks:
- name: Install new checkmk agent
ansible.builtin.apt:
deb: "https://checkmk.stuyckv.com/local/check_mk/agents/check-mk-agent_{{ checkmk_version }}-1_all.deb"
when: ansible_facts.lsb.id == 'Ubuntu'
# registering again renews the agent certificate
- name: Register agent with the site
when: ansible_facts.lsb.id == 'Ubuntu'
changed_when: true
ansible.builtin.command:
argv:
- cmk-agent-ctl
- register
- --trust-cert
- --hostname={{ inventory_hostname }}
- --server={{ checkmk_server }}
- --site={{ checkmk_api_site }}
- --user={{ checkmk_api_user }}
- --password={{ checkmk_api_secret }}