Add kiwix role to ansible playbook

Manages kiwix-serve LaunchAgent configuration for the wikipedia
mirror on indri (port 5501).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-01-13 21:58:12 -08:00
commit 0d2978259d
5 changed files with 47 additions and 0 deletions

View file

@ -4,3 +4,4 @@
roles: roles:
- prometheus - prometheus
- grafana - grafana
- kiwix

View file

@ -0,0 +1,5 @@
---
kiwix_serve_bin: /Users/erichblume/code/3rd/kiwix-tools/kiwix-serve
kiwix_zim_file: /Users/erichblume/code/3rd/kiwix-tools/wikipedia_en_top1m_maxi_2025-09.zim
kiwix_port: 5501
kiwix_log_dir: /Users/erichblume/Library/Logs

View file

@ -0,0 +1,5 @@
---
- name: restart kiwix-serve
ansible.builtin.shell: |
launchctl unload ~/Library/LaunchAgents/mcquack.eblume.kiwix-serve.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/mcquack.eblume.kiwix-serve.plist

View file

@ -0,0 +1,13 @@
---
- name: Deploy kiwix-serve LaunchAgent plist
ansible.builtin.template:
src: kiwix-serve.plist.j2
dest: ~/Library/LaunchAgents/mcquack.eblume.kiwix-serve.plist
mode: '0644'
notify: restart kiwix-serve
- name: Ensure kiwix-serve is loaded
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.kiwix-serve.plist
register: launchctl_load
changed_when: launchctl_load.rc == 0
failed_when: false

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- {{ ansible_managed }} -->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>mcquack.eblume.kiwix-serve</string>
<key>ProgramArguments</key>
<array>
<string>{{ kiwix_serve_bin }}</string>
<string>--port={{ kiwix_port }}</string>
<string>{{ kiwix_zim_file }}</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>{{ kiwix_log_dir }}/mcquack.kiwix-serve.err.log</string>
<key>StandardOutPath</key>
<string>{{ kiwix_log_dir }}/mcquack.kiwix-serve.out.log</string>
</dict>
</plist>