blumeops/ansible/roles/transmission/tasks/main.yml
Erich Blume 3847c12b42 Fix transmission config to prevent perpetual ansible diffs
- Expand settings.json template to include all transmission defaults
- Use static pre-hashed rpc-password so transmission doesn't regenerate
- Change file mode from 0644 to 0600 to match transmission's default
- Add Jinja comment explaining the RPC password workaround

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 13:03:46 -08:00

52 lines
1.5 KiB
YAML

---
- 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: Remove old config directory (was deployed to wrong location)
ansible.builtin.file:
path: ~/.config/transmission-daemon
state: absent
# Note: transmission must be stopped before modifying settings.json
# otherwise it may overwrite our changes on shutdown
- name: Check if settings.json needs updating
ansible.builtin.template:
src: settings.json.j2
dest: "{{ transmission_config_dir }}/settings.json"
mode: '0600'
check_mode: true
register: settings_check
- name: Stop transmission before config changes
ansible.builtin.command: brew services stop transmission-cli
when: settings_check.changed
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: '0600'
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