summaryrefslogtreecommitdiff
path: root/roles/skillz/torrent/tasks/main.yml
blob: 56901959a3188365fc52e2e7f451728683f113ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
- name: formatting data disk
  filesystem:
    fstype: ext4
    dev: /dev/sdb

- name: mount data disk to /srv
  mount:
    path: /srv
    src: /dev/sdb
    fstype: ext4
    opts: nodev,nosuid,,x-systemd.automount,nofail
    state: mounted

- name: install transmission daemon
  apt:
    name:
      - transmission-daemon
    state: present

- name: create data directories
  loop:
    - /srv/incomplete
    - /srv/downloads
  file:
    path: "{{ item }}"
    state: directory
    owner: debian-transmission
    group: debian-transmission
    mode: 0750

- name: configure transmission
  loop:
    - regexp: '^(\s*)"rpc-bind-address":'
      line: '\1"rpc-bind-address": "127.0.0.1",'
    - regexp: '^(\s*)"incomplete-dir":'
      line: '\1"incomplete-dir": "/srv/incomplete",'
    - regexp: '^(\s*)"download-dir":'
      line: '\1"download-dir": "/srv/downloads",'
    - regexp: '^(\s*)"rpc-password":'
      line: '\1"rpc-password": "{{ transmission_rpc_password }}",'
    - regexp: '^(\s*)"rpc-username":'
      line: '\1"rpc-username": "{{ transmission_rpc_username }}",'
  loop_control:
    label: "{{ item.regexp }}"
  lineinfile:
    path: /etc/transmission-daemon/settings.json
    backrefs: true
    regexp: "{{ item.regexp }}"
    line: "{{ item.line }}"
  notify: reload transmission-daemon