generated from GamingChaos/ansible-repository-template
Renew Checkmk agent certificates during updates
This commit is contained in:
@@ -37,8 +37,8 @@ The `# noqa:` annotations in the playbooks are for ansible-lint (`ansible-lint p
|
||||
|
||||
- `update-checkmk.yml` has three plays that share state through a fact:
|
||||
1. On `all` hosts, delegated to localhost, it gets the latest stable Checkmk tag from GitHub with `git ls-remote` and sets `checkmk_version`. It targets `all` on purpose: a `set_fact` only applies to the hosts in its own play, so `sites` and `agents` would lose the fact if the play ran only on `localhost` (or they'd have to read `hostvars['localhost'].checkmk_version`).
|
||||
2. On `sites`, it snapshots the VM through the Proxmox API (delegated to localhost, using `inventory_hostname_short` as the Proxmox VM name), installs the community-edition `.deb`, then runs `omd stop`, `backup`, `update` and `start` for each entry in `checkmk_sites`.
|
||||
3. On `agents`, it installs the agent `.deb` from the local Checkmk server (`checkmk.stuyckv.com/local`).
|
||||
2. On `sites`, it reads the installed version with `omd version -b` (as the login user, no `become`) and ends the play for that host (`meta: end_host`) when it already matches `checkmk_version`. Otherwise it snapshots the VM through the Proxmox API (delegated to localhost, using `inventory_hostname_short` as the Proxmox VM name), installs the community-edition `.deb`, then runs `omd stop`, `backup`, `update` and `start` for each entry in `checkmk_sites`.
|
||||
3. On `agents`, it installs the agent `.deb` from the local Checkmk server (`checkmk.stuyckv.com/local`), then registers the agent for TLS with `cmk-agent-ctl register`, using the `checkmk_api_*` vars. It registers on every run on purpose, because registering again renews the agent certificate. `checkmk.general` has an `agent` role but no `agent` module, so this is done with a plain command.
|
||||
|
||||
Package installs only run when `ansible_facts.lsb.id == 'Ubuntu'`.
|
||||
- `update-debian.yml` runs against `ubuntu`. It sets a Checkmk downtime through `checkmk.general`, then runs dist-upgrade, reboots if needed and autoremoves. Like the Proxmox snapshot, the downtime task is delegated to localhost with `become: false`.
|
||||
|
||||
Reference in New Issue
Block a user