Mac: weekly Hermes update notice on Telegram

Hermes has no auto-update for itself, and /update from Telegram can leave
a launchd gateway offline. Instead, a no-agent Hermes cron job runs
`hermes update --check` on Mondays at 09:07 and messages Telegram only when
a new stable release is out (a failing check sends an error alert).

Adds hermes_cron_jobs (scripts in files/hermes-scripts/, copied to
~/.hermes/scripts/; jobs created when missing) so the deal checker can
follow the same pattern.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 06:59:37 -07:00
1 parent eff53f2503
commit 2d23b9c470
5 files changed
+60

No files matched your search

+5
View File
@@ -26,6 +26,11 @@ Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`,
`hermes_settings` (`group_vars/mac/main.yml`), checked with
`hermes config get` and fixed with `hermes config set`. Today: a full
backup of `~/.hermes` before every `hermes update`.
- **Hermes cron jobs** (tag `hermes-cron`): `hermes_cron_jobs` in
`group_vars/mac/main.yml`, with their scripts from `files/hermes-scripts/`
copied to `~/.hermes/scripts/`. Missing jobs are created; existing ones are
left as they are. Today: `hermes-update-notice`, which messages you on
Telegram on Mondays only when a new stable Hermes release is out.
Ansible logs in as `phil`. sudo needs phil's password, which is in the vault
as `vault_cogitator02.become_password`; only tasks with `become: true` use it.
@@ -0,0 +1,14 @@
#!/bin/bash
# Hermes cron job (no agent): stdout goes to Telegram, empty stdout sends
# nothing, a non-zero exit sends an error alert. Silent while Hermes is on
# the latest stable release.
out=$("$HOME/.local/bin/hermes" update --check 2>&1) || {
echo "Hermes update check failed:"
echo "$out" | tail -5
exit 1
}
grep -q "Up to date" <<<"$out" && exit 0
echo "Hermes on cogitator-02 has an update:"
grep -v "^→ Update channel" <<<"$out"
echo
echo "Ask Claude to run it (backup, update, checks). Avoid /update in Telegram."
+27
View File
@@ -0,0 +1,27 @@
- name: Hermes cron scripts
ansible.builtin.copy:
src: "hermes-scripts/{{ item.script }}"
dest: "{{ ansible_user_dir }}/.hermes/scripts/"
mode: "0700"
loop: "{{ hermes_cron_jobs | selectattr('script', 'defined') }}"
loop_control:
label: "{{ item.script }}"
- name: List Hermes cron jobs
ansible.builtin.command:
argv: ["{{ hermes_cli }}", cron, list, --all]
register: hermes_cron_list
changed_when: false
check_mode: false
- name: Create missing Hermes cron jobs
ansible.builtin.command:
argv: >-
{{ [hermes_cli, 'cron', 'create', item.schedule, '--name', item.name, '--deliver', item.deliver]
+ (['--script', item.script] if item.script is defined else [])
+ (['--no-agent'] if item.no_agent | default(false) else [])
+ ([item.prompt] if item.prompt is defined else []) }}
loop: "{{ hermes_cron_jobs }}"
loop_control:
label: "{{ item.name }}"
when: item.name not in hermes_cron_list.stdout
+4
View File
@@ -37,3 +37,7 @@
- name: Hermes settings
ansible.builtin.import_tasks: hermes-settings.yml
tags: hermes-settings
- name: Hermes cron jobs
ansible.builtin.import_tasks: hermes-cron.yml
tags: hermes-cron