aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/torrents/tasks/setup.yaml
blob: 1aaaa830a339b670c922c2c60b00591ad966a191 (plain)
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
---

- name: 'setup | Install required pkgs'
  ansible.builtin.package:
    name:
      - 'nfs-common'
      - 'transmission-daemon'

- name: 'setup | Stop the transmission-daemon service'
  ansible.builtin.service:
    name: 'transmission-daemon'
    state: 'stopped'

- name: 'setup | Create the mount dir'
  ansible.builtin.file:
    path: '/mnt/data'
    state: 'directory'
    mode: '755'

- name: 'setup | Setup the NFS mount'
  ansible.posix.mount:
    src: '{{ torrents_nas_mount_path }}'
    path: '/mnt/data'
    state: 'mounted'
    fstype: 'nfs'

- name: 'setup | Create new user for transmission'
  ansible.builtin.user:
    name: 'transmission-user'
    uid: 1001
    groups: 'users'
    create_home: true

- name: 'setup | Fix the service file to use our user'
  ansible.builtin.lineinfile:
    path: '/lib/systemd/system/transmission-daemon.service'
    regexp: '^User='
    line: 'User=transmission-user'

- name: 'setup | Reload systemd daemon'
  ansible.builtin.systemd:
    daemon_reload: true

# THis is kind of a hack to force the generation of
# /home/transmission-user/.config/transmission-daemon dirs
# so that we can place our config file there.
- name: 'setup | Start the service'
  ansible.builtin.service:
    name: 'transmission-daemon'
    state: 'started'