Add transmission role for torrent-based ZIM downloads

- Add new transmission ansible role using homebrew + brew services
- Configure transmission to download to ~/transmission with localhost-only RPC
- Modify kiwix role to use transmission for downloading ZIM archives via BitTorrent
- Add role dependency so running --tags kiwix auto-runs transmission
- Keep fallback to direct HTTP download when kiwix_use_transmission: false
- Symlink completed downloads from transmission dir to kiwix-tools dir

This reduces load on kiwix.org servers and allows downloads to continue
in the background without blocking ansible runs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-01-14 11:06:02 -08:00
commit b865d70456
8 changed files with 238 additions and 6 deletions

View file

@ -0,0 +1,42 @@
---
- name: Install transmission-cli via homebrew
community.general.homebrew:
name: transmission-cli
state: present
- name: Ensure transmission download directory exists
ansible.builtin.file:
path: "{{ transmission_download_dir }}"
state: directory
mode: '0755'
- name: Ensure transmission incomplete directory exists
ansible.builtin.file:
path: "{{ transmission_incomplete_dir }}"
state: directory
mode: '0755'
- name: Ensure transmission config directory exists
ansible.builtin.file:
path: "{{ transmission_config_dir }}"
state: directory
mode: '0755'
- name: Stop transmission before config changes
ansible.builtin.command: brew services stop transmission-cli
register: brew_stop
changed_when: false
failed_when: false
- name: Deploy transmission settings.json
ansible.builtin.template:
src: settings.json.j2
dest: "{{ transmission_config_dir }}/settings.json"
mode: '0644'
notify: restart transmission
- name: Ensure transmission service is started
ansible.builtin.command: brew services start transmission-cli
register: brew_start
changed_when: "'Successfully started' in brew_start.stdout"
failed_when: false