Files
ansible/roles/mac/tasks/hermes-settings.yml
T
PhilandClaude Opus 5.5 cccdca1469 Mac: Karakeep MCP server for Hermes
Hermes can search and read bookmarks, create them, tag them and add them
to lists from Telegram. Per Karakeep's MCP README and Hermes's MCP docs:
- the official server image (pinned 0.34.1) runs in a throwaway Podman
  container (`podman run -i --rm`), started on first use and stopped
  after 10 idle minutes;
- only search/read/create/tag/add-to-list tools are registered (no update
  or delete); trust: full because Karakeep doesn't mark its search tools
  read-only;
- the API key is in the vault, written to ~/.hermes/.env via the new
  hermes_env_secrets, and passed into the container by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 08:29:54 -07:00

41 lines
1.7 KiB
YAML

# Secrets go in first, so servers and settings that reference them
# (${VAR}) find them when the gateway restarts.
- name: Secrets in Hermes's .env
ansible.builtin.lineinfile:
path: "{{ hermes_env }}"
regexp: "^{{ item.key }}="
line: "{{ item.key }}='{{ item.value }}'"
mode: "0600"
loop: "{{ hermes_env_secrets | default({}) | dict2items }}"
no_log: true
diff: false
notify: [Restart Hermes gateway, Restart Hermes dashboard]
# `hermes config get` prints the value as YAML, so it's compared
# structurally; `hermes config set` takes JSON for lists and booleans.
# Settings are always set explicitly: for a key that isn't in config.yaml,
# `config get` (non-interactive) prints just the default when there is one,
# so "unset" can't be detected.
- name: Read Hermes settings
ansible.builtin.command:
argv: ["{{ hermes_cli }}", config, get, "{{ item.key }}"]
loop: "{{ hermes_settings | dict2items }}"
register: hermes_settings_current
changed_when: false
# Exit 1 = "Config key not set" (only for keys without a built-in default).
failed_when: hermes_settings_current.rc > 1
check_mode: false
- name: Set Hermes settings
ansible.builtin.command:
argv: >-
{{ [hermes_cli, 'config', 'set']
+ (['--force'] if item.item.key in hermes_settings_force | default([]) else [])
+ [item.item.key, item.item.value if item.item.value is string else item.item.value | to_json] }}
loop: "{{ hermes_settings_current.results }}"
loop_control:
label: "{{ item.item.key }} = {{ item.item.value | to_json }}"
when: (none if item.rc == 1 else item.stdout | from_yaml) != item.item.value
# The dashboard is a separate process with its own copy of the settings.
notify: [Restart Hermes gateway, Restart Hermes dashboard]