diff --git a/roles/calibre-web/tasks/install.yml b/roles/calibre-web/tasks/install.yml index 9f58f1383..b6411b7f4 100644 --- a/roles/calibre-web/tasks/install.yml +++ b/roles/calibre-web/tasks/install.yml @@ -13,13 +13,13 @@ line: ' ' state: present -- name: "Create 3 Calibre-Web folders to store data and config files: {{ calibreweb_home }}, {{ calibreweb_venv_path }}, {{ calibreweb_config }} (all set to {{ calibreweb_user }}:{{ apache_user }}, '0755')" +- name: "Create 3 Calibre-Web folders to store data and config files: {{ calibreweb_home }}, {{ calibreweb_venv_path }}, {{ calibreweb_config }} (all set to {{ calibreweb_user }}:{{ apache_user }})" file: state: directory path: "{{ item }}" owner: "{{ calibreweb_user }}" # root group: "{{ apache_user }}" # www-data on debuntu - mode: '0755' + #mode: '0755' with_items: - "{{ calibreweb_home }}" # /library/calibre-web - "{{ calibreweb_config }}" # /library/calibre-web/config @@ -74,7 +74,7 @@ dest: "{{ calibreweb_home }}" # /library/calibre-web owner: "{{ calibreweb_user }}" # root group: "{{ apache_user }}" # www-data on debuntu - mode: '0644' + #mode: '0644' backup: yes with_items: - roles/calibre-web/files/metadata.db @@ -88,7 +88,7 @@ dest: "{{ calibreweb_config }}" # /library/calibre-web/config owner: "{{ calibreweb_user }}" # root group: "{{ apache_user }}" # www-data on debuntu - mode: '0644' + #mode: '0644' backup: yes when: not metadatadb.stat.exists #when: calibreweb_provision diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 0ba4a0941..16a9a1341 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -5,7 +5,7 @@ timeout: "{{ download_timeout }}" when: internet_available -# 2020-01-19: https://github.com/piwheels/packages/issues/74 says the following is not longer needed... +# 2020-01-19: https://github.com/piwheels/packages/issues/74 says the following is no longer needed... #- name: Run 'mv /etc/pip.conf /etc/pip.conf.see-iiab-issue-2139' as "TEMPORARY" workaround (2020-01-17) for piwheels.org's setuptools Python 2/3 brokenness on RPi (https://github.com/iiab/iiab/issues/2139) # command: mv /etc/pip.conf /etc/pip.conf.see-iiab-issue-2139 # ignore_errors: yes @@ -31,7 +31,7 @@ when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19) # long form of (is_debian_11+ or is_ubuntu_20+) -- name: Use pip to install KA Lite static to {{ kalite_venv }} +- name: Use pip to install ka-lite-static to {{ kalite_venv }} pip: name: ka-lite-static version: "{{ kalite_version }}" diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index b61385d5d..2de521963 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -1,3 +1,14 @@ +.. |ss| raw:: html + + + +.. |se| raw:: html + + + +.. |nbsp| unicode:: 0xA0 + :trim: + =================== Transmission README =================== @@ -17,30 +28,24 @@ Caveat emptor! (That's Latin for "Buyer Beware") Using It -------- -Install Transmission by setting 'transmission_install' and 'transmission_enabled' to True in `/etc/iiab/local_vars.yml `_ — carefully choosing language(s) for KA Lite videos you want to download — and then run:: +Install Transmission by setting 'transmission_install' and 'transmission_enabled' to True in `/etc/iiab/local_vars.yml `_ — carefully choosing language(s) for KA Lite videos you want to download — and then install IIAB. Or, if IIAB is already installed, run as root:: cd /opt/iiab/iiab ./runrole transmission - ./iiab-network - -Or if you prefer a complete reinstall of IIAB:: - - cd /opt/iiab/iiab - ./iiab-install --reinstall -Login to Transmission's web interface http://box:9091 using administrative account:: +Log in to Transmission's web interface http://box:9091 using administrative account:: Username: Admin Password: changeme -Alternatively, you can run ``transmission-remote`` at the command-line. +If you prefer the command-line, you can instead run `transmission-remote `_ commands. Configuration ------------- Configure Transmission using its web interface: http://box:9091 -More settings can be changed within /etc/transmission-daemon/settings.json if you first ensure that the transmission-daemon.service is stopped:: +More settings can be changed within `/etc/transmission-daemon/settings.json `_ if you first ensure that the transmission-daemon.service is stopped:: systemctl stop transmission-daemon @@ -48,12 +53,14 @@ Then edit the file:: nano /etc/transmission-daemon/settings.json -Here are some short explanations, as to what those 70+ variables mean: https://github.com/transmission/transmission/wiki/Editing-Configuration-Files +Here are some short explanations, as to what those ~68 variables mean: https://github.com/transmission/transmission/wiki/Editing-Configuration-Files -After saving your changes in 'settings.json' restart Transmission by running:: +After saving your changes in 'settings.json', restart Transmission by running:: systemctl restart transmission-daemon +*2021-03-14: Transmission 2.94 and 3.00 were intermittently* **ignoring** */etc/transmission-daemon/settings.json (presumably when the file was deemed problematic/missing/etc) and creating their own* ``/var/lib/transmission-daemon/.config/transmission-daemon/settings.json`` *(i.e. suddenly a FILE instead of transmission-deamon's out-of-the-box SYMLINK to /etc/transmission-daemon/settings.json). IIAB* `PR #2707 `_ *should fix this problem, by reversing the direction of the symlink created by apt. See* `Troubleshooting <./README.rst#Troubleshooting>`_ *below.* + Adding Torrents --------------- @@ -61,16 +68,16 @@ Transmission can facilitate provisioning content onto your IIAB, e.g. by adding Please read the lettered instructions (A, B, C, D) in `/etc/iiab/local_vars.yml `_ and 'KA Lite Administration: What tips & tricks exist?' at http://FAQ.IIAB.IO outlining how to use Transmission to download and then install KA Lite content. -You can also download other torrents using Transmission's web interface, or by typing 'transmission-remote' at the command-line:: +You can also download other torrents using Transmission's web interface, or by typing `transmission-remote `_ at the command-line:: - transmission-remote -a + transmission-remote -n Admin:changeme -a Known Issues ------------ -* Default Transmission user/group may need fixing (https://github.com/transmission/transmission/issues/537) in some circumstances. You can set Ansible variables 'transmission_user' and 'transmission_group' e.g. in /opt/iiab/iiab/roles/transmission/defaults/main.yml (you might need 'User=' and 'Group=' in systemd unit file /lib/systemd/system/transmission-daemon.service — e.g. both might need to be set to 'debian-transmission' — if so then run 'systemctl daemon-reload' and 'systemctl restart transmission-daemon'). +* |ss| Default Transmission user/group may need fixing (https://github.com/transmission/transmission/issues/537) in some circumstances. You can set Ansible variables 'transmission_user' and 'transmission_group' e.g. in /opt/iiab/iiab/roles/transmission/defaults/main.yml (you might need 'User=' and 'Group=' in systemd unit file /lib/systemd/system/transmission-daemon.service — e.g. both might need to be set to 'debian-transmission' — if so then run 'systemctl daemon-reload' and 'systemctl restart transmission-daemon'). |se| |nbsp| `PR #2703 `_ -* Random Ports: Currently it is not possible to use random ports in the range 49152-65535. It is difficult to open multiple ports in IIAB's iptables-based firewall. +* Random Ports: Currently it is not possible to use random ports in the range 49152-65535, as it's difficult to open multiple ports in IIAB's `iptables-based firewall `_. Troubleshooting --------------- @@ -79,8 +86,34 @@ Verify that transmission-daemon is running:: systemctl status transmission-daemon -Re-check that Transmission's settings are correct here: (by following the instructions above, under 'Configuration') +Re-check that Transmission's settings are correct here: (by following the instructions above, under `Configuration <./README.rst#Configuration>`_) :: /etc/transmission-daemon/settings.json + +More advanced configuration and status are in directory ``/var/lib/transmission-daemon/info/`` (symlinked to /var/lib/transmission-daemon/.config/transmission-daemon/) here:: + + blocklists/ + dht.dat + resume/ + settings.json <- /etc/transmission-daemon/settings.json (PR #2707 CREATES THIS SYMLINK!) + stats.json + torrents/ + +These are further explained in https://github.com/transmission/transmission/wiki/Configuration-Files (to align with the above, apt package transmission-daemon sets user debian-transmission's home directory to ``/var/lib/transmission-daemon`` in /etc/passwd). + +Logging +------- + +To turn on logging and/or record the Process ID (PID), follow these instructions: https://pawelrychlicki.pl/Home/Details/59/transmission-daemon-doesnt-create-a-log-file-nor-a-pid-file-ubuntu-server-1804 + +This gives permissions to user ``debian-transmission`` — if you use these 3 lines in ``/lib/systemd/system/transmission-daemon.service`` : + +:: + + RuntimeDirectory=transmission-daemon + LogsDirectory=transmission-daemon + ExecStart=/usr/bin/transmission-daemon -f --log-error --log-debug --logfile /var/log/transmission-daemon/transmission.log --pid-file /run/transmission-daemon/transmission.pid + +Noting that one should not normally edit files in ``/lib`` or ``/usr/lib`` — systemd has a command for customizing unit files: ``systemctl edit --full transmission-daemon.service`` diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index 023fbc224..380ea6048 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -7,11 +7,13 @@ # Transmission download directory & general owner/group # transmission_download_dir: "{{ content_base }}/transmission/" # /library/transmission/ # transmission_user: debian-transmission -# transmission_group: root +# transmission_group: debian-transmission # Monitor downloads at http://box:9091 or http://box:9091/transmission using Admin/changeme # transmission_http_port: 9091 # transmission_url: /transmission/ +# transmission_whitelist: 127.0.0.1,::1,192.168.*.*,172.18.96.*,10.8.0.* +# transmission_whitelist_enabled: "false" # LOWERCASE STRING for settings.json # transmission_peer_port: 51413 # Provision Transmission with torrent(s) from http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ diff --git a/roles/transmission/tasks/enable-or-disable.yml b/roles/transmission/tasks/enable-or-disable.yml index a5ec5b3b6..8804c5b17 100644 --- a/roles/transmission/tasks/enable-or-disable.yml +++ b/roles/transmission/tasks/enable-or-disable.yml @@ -6,6 +6,9 @@ state: restarted when: transmission_enabled +- debug: + var: transmission_kalite_languages + - name: Add PAUSED KA Lite torrent(s) to transmission-daemon's queue shell: > /usr/bin/transmission-remote @@ -13,7 +16,7 @@ -n {{ transmission_username }}:{{ transmission_password }} -a http://pantry.learningequality.org/downloads/ka-lite/{{ transmission_kalite_version }}/content/ka-lite-0.17-resized-videos-{{ item }}.torrent with_items: "{{ transmission_kalite_languages }}" - when: transmission_enabled and transmission_provision and transmission_kalite_languages is defined and transmission_kalite_languages is not none + when: transmission_enabled and transmission_provision and transmission_kalite_languages is defined and transmission_kalite_languages is not none # '!= None' also works (i.e. to avoid var value 'null', with type 'NoneType') ignore_errors: yes - name: Disable & Stop 'transmission-daemon' service, if not transmission_enabled diff --git a/roles/transmission/tasks/install.yml b/roles/transmission/tasks/install.yml index 684b3fe14..015116b82 100644 --- a/roles/transmission/tasks/install.yml +++ b/roles/transmission/tasks/install.yml @@ -9,8 +9,8 @@ file: state: directory path: "{{ transmission_download_dir }}" # /library/transmission - owner: "{{ transmission_user }}" # debian-transmission - group: "{{ transmission_group }}" # root + owner: "{{ transmission_user }}" # debian-transmission + group: "{{ transmission_group }}" # debian-transmission # mode: '0755' - name: Stop 'transmission-daemon' systemd service, before modifying its settings @@ -19,13 +19,38 @@ state: stopped ignore_errors: yes -- name: Install /etc/transmission-daemon/settings.json from template +- name: Back up prior /etc/transmission-daemon/settings.json (original file from apt, or new symlink contents) to /etc/transmission-daemon/settings.json.old* + copy: + src: /etc/transmission-daemon/settings.json + dest: /etc/transmission-daemon/settings.json.old + mode: preserve + owner: "{{ transmission_user }}" # debian-transmission + group: "{{ transmission_group }}" # debian-transmission + backup: yes + ignore_errors: yes + +- name: "Back up IIAB's templated version to /etc/transmission-daemon/settings.json.iiab" template: src: settings.json.j2 - dest: /etc/transmission-daemon/settings.json - owner: "{{ transmission_user }}" # debian-transmission - group: "{{ transmission_group }}" # root - # mode: '0644' + dest: /etc/transmission-daemon/settings.json.iiab + owner: "{{ transmission_user }}" # debian-transmission + group: "{{ transmission_group }}" # debian-transmission + mode: '0600' + +- name: Install /var/lib/transmission-daemon/.config/transmission-daemon/settings.json from template + template: + src: settings.json.j2 + dest: /var/lib/transmission-daemon/.config/transmission-daemon/settings.json + owner: "{{ transmission_user }}" # debian-transmission + group: "{{ transmission_group }}" # debian-transmission + mode: '0600' + +- name: "Reverse Transmission's fragile OOTB symlink -- instead we establish /etc/transmission-daemon/settings.json -> /var/lib/transmission-daemon/.config/transmission-daemon/settings.json -- REASON: /etc/transmission-daemon/settings.json was intermittently being IGNORED, as Transmission sometimes breaks its own symlink from /var/lib/transmission-daemon/.config/transmission-daemon/settings.json (by turning it into a file instead)" + file: + path: /etc/transmission-daemon/settings.json + src: /var/lib/transmission-daemon/.config/transmission-daemon/settings.json + state: link + force: yes # RECORD Transmission AS INSTALLED diff --git a/roles/transmission/templates/settings.json.j2 b/roles/transmission/templates/settings.json.j2 index 8e62d0e6f..d0fc5ad14 100644 --- a/roles/transmission/templates/settings.json.j2 +++ b/roles/transmission/templates/settings.json.j2 @@ -13,18 +13,15 @@ "cache-size-mb": 4, "dht-enabled": true, "download-dir": "{{ transmission_download_dir }}", - "download-limit": 100, - "download-limit-enabled": 0, "download-queue-enabled": true, "download-queue-size": 5, "encryption": 1, "idle-seeding-limit": 30, "idle-seeding-limit-enabled": false, - "incomplete-dir": "/var/lib/transmission-daemon/Downloads", + "incomplete-dir": "/var/lib/transmission-daemon/downloads", "incomplete-dir-enabled": false, "lpd-enabled": false, - "max-peers-global": 200, - "message-level": 1, + "message-level": 2, "peer-congestion-algorithm": "", "peer-id-ttl-hours": 6, "peer-limit-global": 200, @@ -35,12 +32,12 @@ "peer-port-random-on-start": false, "peer-socket-tos": "default", "pex-enabled": true, - "port-forwarding-enabled": false, + "port-forwarding-enabled": true, "preallocation": 1, "prefetch-enabled": true, "queue-stalled-enabled": true, "queue-stalled-minutes": 30, - "ratio-limit": 2, + "ratio-limit": 2.0, "ratio-limit-enabled": false, "rename-partial-files": true, "rpc-authentication-required": true, @@ -52,8 +49,8 @@ "rpc-port": {{ transmission_http_port }}, "rpc-url": "{{ transmission_url }}", "rpc-username": "{{ transmission_username }}", - "rpc-whitelist": "127.0.0.1,192.168.*.*,172.18.96.*,10.8.0.*", - "rpc-whitelist-enabled": false, + "rpc-whitelist": "{{ transmission_whitelist }}", + "rpc-whitelist-enabled": {{ transmission_whitelist_enabled }}, "scrape-paused-torrents-enabled": true, "script-torrent-done-enabled": false, "script-torrent-done-filename": "", @@ -66,8 +63,8 @@ "start-added-torrents": true, "trash-original-torrent-files": false, "umask": 18, - "upload-limit": 100, - "upload-limit-enabled": 0, "upload-slots-per-torrent": 14, - "utp-enabled": true + "utp-enabled": true, + "watch-dir": "", + "watch-dir-enabled": false } diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 1f7351cc9..8dc0ddc90 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -507,11 +507,13 @@ transmission_password: changeme # Transmission download directory & general owner/group transmission_download_dir: "{{ content_base }}/transmission/" # /library/transmission/ transmission_user: debian-transmission -transmission_group: root +transmission_group: debian-transmission # Monitor downloads at http://box:9091 or http://box:9091/transmission using Admin/changeme transmission_http_port: 9091 -transmission_url : /transmission/ +transmission_url: /transmission/ +transmission_whitelist: 127.0.0.1,::1,192.168.*.*,172.18.96.*,10.8.0.* +transmission_whitelist_enabled: "false" # LOWERCASE STRING for settings.json transmission_peer_port: 51413 # Provision Transmission with torrent(s) from http://pantry.learningequality.org/downloads/ka-lite/0.17/content/