transmission/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Mon, 05 Sep 2022 11:14:48 -0500
changeset 186 c48761176ede
parent 42 edb53dfadfb5
child 204 fd38efd8f637
permissions -rw-r--r--
Minor version updates and bug fixes.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: install transmission
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  apt: name="transmission-daemon"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
42
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
     8
- name: create data dir
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
     9
  become: yes
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    10
  file:
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    11
    path: "{{transmission_download_dir}}"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    12
    state: "directory"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    13
    owner: "{{transmission_user}}"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    14
    group: "{{transmission_user}}"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    15
    mode: "0755"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    16
    recurse: "yes"
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    17
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
- name: stop transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
  systemd: name="transmission-daemon" state="stopped" daemon_reload="yes"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
  become: yes
28
d289eab1ea52 Made transmission idempotent.
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    21
  changed_when: false
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
- name: config ip whitelist
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
    regexp: '^    "rpc-whitelist":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    line: '    "rpc-whitelist": "127.0.0.1,192.168.*.*",'
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    29
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
- name: config umask
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
    regexp: '^    "umask":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    line: '    "umask": 2,'
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    38
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
- name: config port
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    43
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    44
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    45
    regexp: '^    "rpc-port":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    46
    line: "    \"rpc-port\": {{transmission_port}},"
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    47
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    48
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    49
28
d289eab1ea52 Made transmission idempotent.
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    50
# the password is hashed at start of server so this always changes
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    51
- name: config password
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    52
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    53
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    54
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    55
    regexp: '^    "rpc-password":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    56
    line: "    \"rpc-password\": \"{{transmission_passwd}}\","
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    57
    insertafter: ",$"
28
d289eab1ea52 Made transmission idempotent.
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    58
  changed_when: false
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
- name: config download dir
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    61
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    62
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    63
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    64
    regexp: '^    "download-dir":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    65
    line: "    \"download-dir\": \"{{transmission_download_dir}}\","
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    66
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    67
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    68
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    69
- name: config disable seeding
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    70
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    71
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    72
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    73
    regexp: '^    "idle-seeding-limit":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    74
    line: "    \"idle-seeding-limit\": 0,"
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    75
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    76
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    77
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    78
- name: config disable seeding
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    79
  become: yes
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    80
  lineinfile:
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    81
    path: "{{transmission_config}}"
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    82
    regexp: '^    "idle-seeding-limit-enabled":'
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    83
    line: "    \"idle-seeding-limit-enabled\": true,"
34
ecbdaed7f151 various updates
Luke Hoersten <luke@hoersten.org>
parents: 28
diff changeset
    84
    insertafter: ",$"
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    85
  notify: restart transmission service
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    86
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    87
- name: start transmission service
42
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 34
diff changeset
    88
  become: yes
0
df042396074e Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    89
  systemd: name="transmission-daemon" state="started" daemon_reload="yes"
28
d289eab1ea52 Made transmission idempotent.
Luke Hoersten <luke@hoersten.org>
parents: 2
diff changeset
    90
  changed_when: false