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:
1 parent
eff53f2503
commit
2d23b9c470
5 files changed
+60
No files matched your search
@@ -29,3 +29,13 @@ hermes_dashboard_username: admin
|
|||||||
# ~/.hermes/config.yaml stays Hermes's own (its updates migrate that file).
|
# ~/.hermes/config.yaml stays Hermes's own (its updates migrate that file).
|
||||||
hermes_settings:
|
hermes_settings:
|
||||||
updates.pre_update_backup: full # zip of ~/.hermes before every update
|
updates.pre_update_backup: full # zip of ~/.hermes before every update
|
||||||
|
|
||||||
|
# Hermes cron jobs. `script` is a file in roles/mac/files/hermes-scripts/,
|
||||||
|
# copied to ~/.hermes/scripts/. Jobs are created when missing; to change one,
|
||||||
|
# edit or remove it in Hermes (`hermes cron edit|remove <name>`) and redeploy.
|
||||||
|
hermes_cron_jobs:
|
||||||
|
- name: hermes-update-notice
|
||||||
|
schedule: "7 9 * * 1" # Mondays 09:07
|
||||||
|
script: hermes-update-notice.sh
|
||||||
|
no_agent: true # just the script's output, no model
|
||||||
|
deliver: telegram
|
||||||
@@ -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_settings` (`group_vars/mac/main.yml`), checked with
|
||||||
`hermes config get` and fixed with `hermes config set`. Today: a full
|
`hermes config get` and fixed with `hermes config set`. Today: a full
|
||||||
backup of `~/.hermes` before every `hermes update`.
|
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
|
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.
|
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."
|
||||||
@@ -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
|
||||||
@@ -37,3 +37,7 @@
|
|||||||
- name: Hermes settings
|
- name: Hermes settings
|
||||||
ansible.builtin.import_tasks: hermes-settings.yml
|
ansible.builtin.import_tasks: hermes-settings.yml
|
||||||
tags: hermes-settings
|
tags: hermes-settings
|
||||||
|
|
||||||
|
- name: Hermes cron jobs
|
||||||
|
ansible.builtin.import_tasks: hermes-cron.yml
|
||||||
|
tags: hermes-cron
|
||||||
Reference in new issue
Block a user