From c27b6d31aeef0871f26cc8e7bceca9a5eeac8a22 Mon Sep 17 00:00:00 2001 From: Arky Date: Thu, 16 Aug 2018 16:36:45 +0700 Subject: [PATCH 01/16] Initial Import --- roles/transmission/README.rst | 32 ++++++++++++++++++++++++++++ roles/transmission/defaults/main.yml | 6 ++++++ roles/transmission/tasks/main.yml | 25 ++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 roles/transmission/README.rst create mode 100644 roles/transmission/defaults/main.yml create mode 100644 roles/transmission/tasks/main.yml diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst new file mode 100644 index 000000000..4f51851e8 --- /dev/null +++ b/roles/transmission/README.rst @@ -0,0 +1,32 @@ +===================== +Transmission README +===================== +Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All its incarnations feature a very simple, intuitive + interface on top on an efficient, cross-platform back-end. + +In Internet in a box we are using transmission-daemon, transmission-cli and transmission-remote-cli. + +#transmission-cli - lightweight BitTorrent client (command line programs) +#transmission-daemon - lightweight BitTorrent client (daemon) +#transmission-remote-cli - ncurses interface for the Transmission BitTorrent daemon + + Access + ------ + +You can access transmission using http://box/port or using the command line program. + + + Adding torrents + --------------- + +The torrents are added by provisioning system based on the variables. You can also add +your own torrent using web UI or command-line option. + +$ transmission-remote-cli http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ \ +ka-lite-0.17-resized-videos-english.torrent + + + + + Troubleshooting + ---------------- diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml new file mode 100644 index 000000000..9bf6bb63a --- /dev/null +++ b/roles/transmission/defaults/main.yml @@ -0,0 +1,6 @@ +# The values here are defaults. +# To override them edit /etc/iiab/local_vars.yml + +# Installation Variables +transmission_install: False +transmission_enabled: False diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml new file mode 100644 index 000000000..49bb612d8 --- /dev/null +++ b/roles/transmission/tasks/main.yml @@ -0,0 +1,25 @@ +--- +- name: Install Transmission daemon and cli-tools. + package: + name: "{{ item }}" + state: present + with_items: + - transmission-daemon + - transmission-remote-cli + - transmission-cli + +- name: Add transmission to list of services at /etc/iiab/iiab.ini + ini_file: + dest: "{{ service_filelist }}" + section: transmission + option: "{{ item.option }}" + value: "{{ item.value }}" + with_items: + - option: name + value: transmission + - option: description + value: '"Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form)."' + - option: transmission_enabled + value: "{{ transmission_enabled }}" + - option: transmission_install + value: "{{ transmission_install }}" From 78dace3a3ee593cafcba74d28845fb5fd1f1e61d Mon Sep 17 00:00:00 2001 From: Arky Date: Fri, 17 Aug 2018 00:46:23 +0700 Subject: [PATCH 02/16] Removing transmission-remote-cli: Not found on Raspbian --- roles/transmission/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 49bb612d8..48d8ef1d8 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -5,7 +5,6 @@ state: present with_items: - transmission-daemon - - transmission-remote-cli - transmission-cli - name: Add transmission to list of services at /etc/iiab/iiab.ini From 6e846399028ffc5c94f3254968bb4b122266619d Mon Sep 17 00:00:00 2001 From: Arky Date: Fri, 17 Aug 2018 01:54:55 +0700 Subject: [PATCH 03/16] Proof-of-Concept: Install and Start downloading a torrent --- .../templates/gateway/iiab-gen-iptables | 2 + roles/transmission/README.rst | 18 ++--- roles/transmission/defaults/main.yml | 18 +++++ roles/transmission/tasks/main.yml | 38 ++++++++++ roles/transmission/templates/settings.json.j2 | 73 +++++++++++++++++++ 5 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 roles/transmission/templates/settings.json.j2 diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 812fe1b39..7271e2f32 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -94,6 +94,8 @@ if [ "$services_externally_visible" == "True" ]; then $IPTABLES -A INPUT -p tcp --dport $kolibri_http_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $calibre_port -m state --state NEW -i $wan -j ACCEPT $IPTABLES -A INPUT -p tcp --dport $sugarizer_port -m state --state NEW -i $wan -j ACCEPT + $IPTABLES -A INPUT -p tcp --dport $transmission_http_port -m state --state NEW -i $wan -j ACCEPT + $IPTABLES -A INPUT -p tcp --dport $transmission_peer_port -m state --state NEW -i $wan -j ACCEPT fi if [ "$iiab_gateway_enabled" == "True" ]; then diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index 4f51851e8..53ea77678 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -4,26 +4,26 @@ Transmission README Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All its incarnations feature a very simple, intuitive interface on top on an efficient, cross-platform back-end. -In Internet in a box we are using transmission-daemon, transmission-cli and transmission-remote-cli. - -#transmission-cli - lightweight BitTorrent client (command line programs) -#transmission-daemon - lightweight BitTorrent client (daemon) -#transmission-remote-cli - ncurses interface for the Transmission BitTorrent daemon +Caution +------- +Usage of transmission consumes significant Internet data and system resources. +Caveat emptor! (That's Latin for "Buyer Beware"). Access ------ -You can access transmission using http://box/port or using the command line program. +You can login transmission using http://box:9091/ or using the command line program. +Username: Admin +Password: changeme Adding torrents --------------- The torrents are added by provisioning system based on the variables. You can also add -your own torrent using web UI or command-line option. +your own torrent using web UI or command-line option. -$ transmission-remote-cli http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ \ -ka-lite-0.17-resized-videos-english.torrent +$ transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index 9bf6bb63a..91d05059f 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -4,3 +4,21 @@ # Installation Variables transmission_install: False transmission_enabled: False + +# Provision Transmission with default torrents +transmission_provision: True + +transmission_KaLite-Version: 0.17 +transmission_KaLite-Languages: English + +transmission_download_dir: /library/transmission + +#TODO Open this port to WAN. +#TODO Also open the default peer port 51413 and range 65535-49152 +transmission_http_port: 9091 +transmission_peer_port: 51413 + +transmission_url : "/transmission/" + +transmission_username: Admin +transmission_password: changeme diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 48d8ef1d8..2890910d1 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -1,4 +1,14 @@ --- +- name: Create Transmission download directory + file: + path: "{{ item }}" + owner: root + group: root + mode: 0755 + state: directory + with_items: + - "{{ transmission_download_dir }}" + - name: Install Transmission daemon and cli-tools. package: name: "{{ item }}" @@ -7,6 +17,34 @@ - transmission-daemon - transmission-cli +- name: Stop Transmission daemon before creating settings. + service: + name: transmission-daemon + state: stopped + +- name: Create the transmission-daemon settings + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + owner: root + group: root + with_items: + - { src: 'settings.json.j2', dest: '/etc/transmission-daemon/settings.json', mode: '0644' } + +- name: Start Transmission daemon. + service: + name: transmission-daemon + state: restarted + enabled: yes + when: transmission_enabled + +# TODO Make this loop transmission_KaLite-Languages +- name: Add a torrent Ka-Lite English + shell: transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent + ignore_errors: yes + when: transmission_provision + - name: Add transmission to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" diff --git a/roles/transmission/templates/settings.json.j2 b/roles/transmission/templates/settings.json.j2 new file mode 100644 index 000000000..067037e07 --- /dev/null +++ b/roles/transmission/templates/settings.json.j2 @@ -0,0 +1,73 @@ +{ + "alt-speed-down": 50, + "alt-speed-enabled": false, + "alt-speed-time-begin": 540, + "alt-speed-time-day": 127, + "alt-speed-time-enabled": false, + "alt-speed-time-end": 1020, + "alt-speed-up": 50, + "bind-address-ipv4": "0.0.0.0", + "bind-address-ipv6": "::", + "blocklist-enabled": false, + "blocklist-url": "http://www.example.com/blocklist", + "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-enabled": false, + "lpd-enabled": false, + "max-peers-global": 200, + "message-level": 1, + "peer-congestion-algorithm": "", + "peer-id-ttl-hours": 6, + "peer-limit-global": 200, + "peer-limit-per-torrent": 50, + "peer-port": "{{ transmission_peer_port }}", + "peer-port-random-high": 65535, + "peer-port-random-low": 49152, + "peer-port-random-on-start": false, + "peer-socket-tos": "default", + "pex-enabled": true, + "port-forwarding-enabled": false, + "preallocation": 1, + "prefetch-enabled": true, + "queue-stalled-enabled": true, + "queue-stalled-minutes": 30, + "ratio-limit": 2, + "ratio-limit-enabled": false, + "rename-partial-files": true, + "rpc-authentication-required": false, + "rpc-bind-address": "0.0.0.0", + "rpc-enabled": true, + "rpc-host-whitelist": "", + "rpc-host-whitelist-enabled": true, + "rpc-password": "{{ transmission_password }}", + "rpc-port": "{{ transmission_http_port }}", + "rpc-url": "{{ transmission_url }}", + "rpc-username": "{{ transmission_username }}", + "rpc-whitelist": "127.0.0.1", + "rpc-whitelist-enabled": true, + "scrape-paused-torrents-enabled": true, + "script-torrent-done-enabled": false, + "script-torrent-done-filename": "", + "seed-queue-enabled": false, + "seed-queue-size": 10, + "speed-limit-down": 100, + "speed-limit-down-enabled": false, + "speed-limit-up": 100, + "speed-limit-up-enabled": false, + "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 +} From 7de870d611bf75b1b516f985294e547f77ac771d Mon Sep 17 00:00:00 2001 From: Arky Date: Fri, 17 Aug 2018 22:40:48 +0700 Subject: [PATCH 04/16] Enable adding multiple language torrents. You can add multiple ka-lite language downloads by using provisioning system. Also added notes to the readme file. --- roles/transmission/README.rst | 7 +++++-- roles/transmission/defaults/main.yml | 16 ++++++++++++---- roles/transmission/tasks/main.yml | 10 ++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index 53ea77678..91b35a7d8 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -22,9 +22,12 @@ Password: changeme The torrents are added by provisioning system based on the variables. You can also add your own torrent using web UI or command-line option. +s +$ transmission-remote -a -$ transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent - +Known Issues +------------- +Currently it is not possible to use random ports in the range 65535-49152. It is difficult to open multiple ports in IIAB firewall. diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index 91d05059f..635e02e4d 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -5,12 +5,20 @@ transmission_install: False transmission_enabled: False -# Provision Transmission with default torrents +# Provision Transmission with default torrents from http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ transmission_provision: True +transmission_kalite_version: 0.17 +# Uncomment to enable a language to download. +transmission_kalite_languages: + - "english" + - "french" + - "hindi" + - "portugal-portuguese" + - "brazilian-portuguese" + - "spanish" + - "swahili" -transmission_KaLite-Version: 0.17 -transmission_KaLite-Languages: English - +# Transmission default download directory. transmission_download_dir: /library/transmission #TODO Open this port to WAN. diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 2890910d1..7c2cc8955 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -40,8 +40,14 @@ when: transmission_enabled # TODO Make this loop transmission_KaLite-Languages -- name: Add a torrent Ka-Lite English - shell: transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent +#- name: Add a torrent Ka-Lite English +# shell: transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent +# ignore_errors: yes +# when: transmission_provision + +- name: Add ka-lite torrents + shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/"{{ transmission_kalite_version }}"/content/ka-lite-0.17-resized-videos-"{{ transmission_kalite_languages }}".torrent + with_items: "{{ transmission_kalite_languages }}" ignore_errors: yes when: transmission_provision From a4d41441568f93511517fe2e103988841d6973e4 Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 11:13:16 +0700 Subject: [PATCH 05/16] Correct transmission variables and use 'to_json' Ensure that transmission_http_port variable is not reset in iiab-gen-iptables. Remote the extra qoutes and also use to_json to clean the transmission_kalite_languages output. Restructure the defaults section. Update the README documentation. --- .../templates/gateway/iiab-gen-iptables | 1 + roles/transmission/README.rst | 30 +++++++++++++++---- roles/transmission/defaults/main.yml | 19 ++++++------ roles/transmission/tasks/main.yml | 2 +- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 7271e2f32..9daa3e5bd 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -58,6 +58,7 @@ calibre_port={{ calibre_port }} kiwix_port={{ kiwix_port }} kalite_server_port={{ kalite_server_port }} kolibri_http_port={{ kolibri_http_port }} +transmission_http_port={{ transmission_http_port }} sugarizer_port={{ sugarizer_port }} block_DNS={{ block_DNS }} captive_portal_enabled={{ captive_portal_enabled }} diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index 91b35a7d8..eeb994ef7 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -4,6 +4,9 @@ Transmission README Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All its incarnations feature a very simple, intuitive interface on top on an efficient, cross-platform back-end. +The transmission program is used to download and seed Ka-Lite packages. Once the packages are download, Please verify the content +before copying them to Ka-Lite content directory. + Caution ------- Usage of transmission consumes significant Internet data and system resources. @@ -12,17 +15,29 @@ Caveat emptor! (That's Latin for "Buyer Beware"). Access ------ -You can login transmission using http://box:9091/ or using the command line program. +You can login transmission using its web interface http://box:9091/ with the following administration account. Username: Admin Password: changeme +Alternatively you can also access transmission using the 'transmission-remote' or 'transmission-remote' on the command line. + +Configuration +-------------- +You can configure transmission using the web interface http://box:9091. + +You can also edit the transmission settings in '/etc/transmission-daemon/settings.json'. Before you start editing the +'settings.json' file, Please ensure that transmission-daemon.service is stop. + +$ sudo systemctl stop transmission-daemon.service +$ sudo nano /etc/transmission-daemon/settings.json + + Adding torrents --------------- +The transmission provisioning system is designed to add ka-Lite packages. You can also use transmission is +download torrent using the Transmission web interface or using 'transmission-remote' program. -The torrents are added by provisioning system based on the variables. You can also add -your own torrent using web UI or command-line option. -s $ transmission-remote -a Known Issues @@ -30,6 +45,11 @@ Known Issues Currently it is not possible to use random ports in the range 65535-49152. It is difficult to open multiple ports in IIAB firewall. - Troubleshooting ---------------- + +Please check if the transmission daemon is running: + +$ sudo systemctl status transmission-daemon.service + +Check the transmission settings '/etc/transmission-daemon/settings.json' are correct. diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index 635e02e4d..f089f9daf 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -5,6 +5,14 @@ transmission_install: False transmission_enabled: False +# Transmission default download directory. +transmission_download_dir: /library/transmission + +# Transmission default web and bittorrent ports +transmission_http_port: 9091 +transmission_peer_port: 51413 +transmission_url : "/transmission/" + # Provision Transmission with default torrents from http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ transmission_provision: True transmission_kalite_version: 0.17 @@ -18,15 +26,6 @@ transmission_kalite_languages: - "spanish" - "swahili" -# Transmission default download directory. -transmission_download_dir: /library/transmission - -#TODO Open this port to WAN. -#TODO Also open the default peer port 51413 and range 65535-49152 -transmission_http_port: 9091 -transmission_peer_port: 51413 - -transmission_url : "/transmission/" - +# Transmission administration account transmission_username: Admin transmission_password: changeme diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 7c2cc8955..eccb9e4c2 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -46,7 +46,7 @@ # when: transmission_provision - name: Add ka-lite torrents - shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/"{{ transmission_kalite_version }}"/content/ka-lite-0.17-resized-videos-"{{ transmission_kalite_languages }}".torrent + shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/{{ transmission_kalite_version }}/content/ka-lite-0.17-resized-videos-{{ transmission_kalite_languages | to_json }}.torrent with_items: "{{ transmission_kalite_languages }}" ignore_errors: yes when: transmission_provision From 3681a0ed56bc61e7aee19bdf484fc60e715d4ece Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 11:18:15 +0700 Subject: [PATCH 06/16] Simple typo corrected --- roles/transmission/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index eeb994ef7..2f461a88c 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -4,7 +4,7 @@ Transmission README Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All its incarnations feature a very simple, intuitive interface on top on an efficient, cross-platform back-end. -The transmission program is used to download and seed Ka-Lite packages. Once the packages are download, Please verify the content +The transmission program is used to download and seed Ka-Lite packages. Once the packages are downloaded, Please verify the content before copying them to Ka-Lite content directory. Caution From 62ed40a792c7962f069bcc2b41604f55f5e46652 Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 11:20:00 +0700 Subject: [PATCH 07/16] Correctly assign transmission_peer_port in iiab-gen-iptables --- roles/network/templates/gateway/iiab-gen-iptables | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 9daa3e5bd..fdd91f56d 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -59,6 +59,7 @@ kiwix_port={{ kiwix_port }} kalite_server_port={{ kalite_server_port }} kolibri_http_port={{ kolibri_http_port }} transmission_http_port={{ transmission_http_port }} +transmission_peer_port={{ transmission_peer_port }} sugarizer_port={{ sugarizer_port }} block_DNS={{ block_DNS }} captive_portal_enabled={{ captive_portal_enabled }} From e89f1eb9d7e4e36fc4a773c558f953db99abfae5 Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 11:26:19 +0700 Subject: [PATCH 08/16] Disable Transmission daemon and update variables --- roles/transmission/tasks/main.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index eccb9e4c2..89282ed9a 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -39,18 +39,20 @@ enabled: yes when: transmission_enabled -# TODO Make this loop transmission_KaLite-Languages -#- name: Add a torrent Ka-Lite English -# shell: transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ka-lite-0.17-resized-videos-english.torrent -# ignore_errors: yes -# when: transmission_provision - - name: Add ka-lite torrents shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/{{ transmission_kalite_version }}/content/ka-lite-0.17-resized-videos-{{ transmission_kalite_languages | to_json }}.torrent with_items: "{{ transmission_kalite_languages }}" ignore_errors: yes when: transmission_provision +- name: Disable Transmission daemon service. + service: + name: transmission-daemon + enabled: no + state: stopped + when: not transmission_enabled + + - name: Add transmission to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" @@ -66,3 +68,7 @@ value: "{{ transmission_enabled }}" - option: transmission_install value: "{{ transmission_install }}" + - option: transmission_http_port + value: "{{ transmission_http_port }}" + - option: transmission_url + value: "{{ Transmission_url }}" From 57f24c3ecafc07f40518ff995b935f2fa85cf38b Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 11:32:45 +0700 Subject: [PATCH 09/16] Minor syntax and cosmetics fixes --- roles/transmission/README.rst | 12 ++++++------ roles/transmission/tasks/main.yml | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index 2f461a88c..466a83300 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -12,8 +12,8 @@ Caution Usage of transmission consumes significant Internet data and system resources. Caveat emptor! (That's Latin for "Buyer Beware"). - Access - ------ +Access +------ You can login transmission using its web interface http://box:9091/ with the following administration account. @@ -33,8 +33,8 @@ $ sudo systemctl stop transmission-daemon.service $ sudo nano /etc/transmission-daemon/settings.json - Adding torrents - --------------- +Adding torrents +--------------- The transmission provisioning system is designed to add ka-Lite packages. You can also use transmission is download torrent using the Transmission web interface or using 'transmission-remote' program. @@ -45,8 +45,8 @@ Known Issues Currently it is not possible to use random ports in the range 65535-49152. It is difficult to open multiple ports in IIAB firewall. - Troubleshooting - ---------------- +Troubleshooting +---------------- Please check if the transmission daemon is running: diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 89282ed9a..f3eb72348 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -9,7 +9,7 @@ with_items: - "{{ transmission_download_dir }}" -- name: Install Transmission daemon and cli-tools. +- name: Install Transmission daemon and its command line tools. package: name: "{{ item }}" state: present @@ -17,7 +17,7 @@ - transmission-daemon - transmission-cli -- name: Stop Transmission daemon before creating settings. +- name: Stop Transmission daemon before modifying its settings. service: name: transmission-daemon state: stopped @@ -39,7 +39,7 @@ enabled: yes when: transmission_enabled -- name: Add ka-lite torrents +- name: Add ka-lite torrents to transmission daemon. shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/{{ transmission_kalite_version }}/content/ka-lite-0.17-resized-videos-{{ transmission_kalite_languages | to_json }}.torrent with_items: "{{ transmission_kalite_languages }}" ignore_errors: yes From 6591d75639a41ec88efc6f593e726c01053cbc9c Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 17:32:35 +0700 Subject: [PATCH 10/16] Correct the variable transmission_url --- roles/transmission/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index f3eb72348..8a515eb6b 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -71,4 +71,4 @@ - option: transmission_http_port value: "{{ transmission_http_port }}" - option: transmission_url - value: "{{ Transmission_url }}" + value: "{{ transmission_url }}" From 7d7774f67212efadf55edef98a29d9bfa022d09f Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 17:43:59 +0700 Subject: [PATCH 11/16] Remote quotes --- roles/transmission/defaults/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index f089f9daf..e6ed2bb18 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -18,13 +18,13 @@ transmission_provision: True transmission_kalite_version: 0.17 # Uncomment to enable a language to download. transmission_kalite_languages: - - "english" - - "french" - - "hindi" - - "portugal-portuguese" - - "brazilian-portuguese" - - "spanish" - - "swahili" + - english + - french + - hindi + - portugal-portuguese + - brazilian-portuguese + - spanish + - swahili # Transmission administration account transmission_username: Admin From ee0f537a9f354f482f35a9314f2c0f08ca0ea1e7 Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 18:04:49 +0700 Subject: [PATCH 12/16] Fix looping issue. --- roles/transmission/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 8a515eb6b..96d712814 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -40,7 +40,7 @@ when: transmission_enabled - name: Add ka-lite torrents to transmission daemon. - shell: /usr/bin/transmission-remote -a http://pantry.learningequality.org/downloads/ka-lite/{{ transmission_kalite_version }}/content/ka-lite-0.17-resized-videos-{{ transmission_kalite_languages | to_json }}.torrent + shell: /usr/bin/transmission-remote -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 }}" ignore_errors: yes when: transmission_provision From b5e587df5eb7e31895229dddb447d16699facac5 Mon Sep 17 00:00:00 2001 From: Arky Date: Sat, 18 Aug 2018 23:23:14 +0700 Subject: [PATCH 13/16] Comment-off languages: Continue to debug transmission_http_port variable issue --- roles/transmission/defaults/main.yml | 11 ++++++----- roles/transmission/templates/settings.json.j2 | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index e6ed2bb18..c6f2f35ae 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -8,7 +8,8 @@ transmission_enabled: False # Transmission default download directory. transmission_download_dir: /library/transmission -# Transmission default web and bittorrent ports +# Transmission default web and bittorrent ports http://box:9091/transmission/ +# TODO: BUG transmission_http_port is not assigned in settings.json? transmission_http_port: 9091 transmission_peer_port: 51413 transmission_url : "/transmission/" @@ -20,11 +21,11 @@ transmission_kalite_version: 0.17 transmission_kalite_languages: - english - french - - hindi + #- hindi - portugal-portuguese - - brazilian-portuguese - - spanish - - swahili + #- brazilian-portuguese + #- spanish + #- swahili # Transmission administration account transmission_username: Admin diff --git a/roles/transmission/templates/settings.json.j2 b/roles/transmission/templates/settings.json.j2 index 067037e07..03da5036b 100644 --- a/roles/transmission/templates/settings.json.j2 +++ b/roles/transmission/templates/settings.json.j2 @@ -12,7 +12,7 @@ "blocklist-url": "http://www.example.com/blocklist", "cache-size-mb": 4, "dht-enabled": true, - "download-dir": "{{ transmission_download_dir }}", + "download-dir": {{ transmission_download_dir }}, "download-limit": 100, "download-limit-enabled": 0, "download-queue-enabled": true, @@ -29,7 +29,7 @@ "peer-id-ttl-hours": 6, "peer-limit-global": 200, "peer-limit-per-torrent": 50, - "peer-port": "{{ transmission_peer_port }}", + "peer-port": {{ transmission_peer_port }}, "peer-port-random-high": 65535, "peer-port-random-low": 49152, "peer-port-random-on-start": false, @@ -48,10 +48,11 @@ "rpc-enabled": true, "rpc-host-whitelist": "", "rpc-host-whitelist-enabled": true, - "rpc-password": "{{ transmission_password }}", - "rpc-port": "{{ transmission_http_port }}", - "rpc-url": "{{ transmission_url }}", - "rpc-username": "{{ transmission_username }}", + "rpc-password": {{ transmission_password }}, + # TODO: BUG transmission_http_port is not assigned in settings.json? + "rpc-port": {{ transmission_http_port }}, + "rpc-url": {{ transmission_url }}, + "rpc-username": {{ transmission_username }}, "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": true, "scrape-paused-torrents-enabled": true, From 5ec4c5ee2d202d727c39a786a4d94fbb06dddb26 Mon Sep 17 00:00:00 2001 From: Arky Date: Mon, 20 Aug 2018 15:51:47 +0700 Subject: [PATCH 14/16] Correct handling strings/numbers in templates, systemd transmission user/group --- roles/transmission/README.rst | 4 ++++ roles/transmission/defaults/main.yml | 9 +++++---- roles/transmission/tasks/main.yml | 9 ++++----- roles/transmission/templates/settings.json.j2 | 11 +++++------ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index 466a83300..f7680ee0f 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -42,6 +42,10 @@ $ transmission-remote -a Known Issues ------------- +* Default Transmission user/group (See https://github.com/transmission/transmission/issues/537) +Currently you need to set these these in "transmission_user" and "transmission_group" variables. You can check +the value for these in transmission-daemon systemd unit file "lib/systemd/system/transmission-daemon.service" +* Random Ports Currently it is not possible to use random ports in the range 65535-49152. It is difficult to open multiple ports in IIAB firewall. diff --git a/roles/transmission/defaults/main.yml b/roles/transmission/defaults/main.yml index c6f2f35ae..ba9c6929e 100644 --- a/roles/transmission/defaults/main.yml +++ b/roles/transmission/defaults/main.yml @@ -6,13 +6,14 @@ transmission_install: False transmission_enabled: False # Transmission default download directory. -transmission_download_dir: /library/transmission +transmission_download_dir: "/library/transmission/" # Transmission default web and bittorrent ports http://box:9091/transmission/ -# TODO: BUG transmission_http_port is not assigned in settings.json? transmission_http_port: 9091 transmission_peer_port: 51413 transmission_url : "/transmission/" +transmission_user: debian-transmission +transmission_group: root # Provision Transmission with default torrents from http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ transmission_provision: True @@ -20,9 +21,9 @@ transmission_kalite_version: 0.17 # Uncomment to enable a language to download. transmission_kalite_languages: - english - - french + #- french #- hindi - - portugal-portuguese + #- portugal-portuguese #- brazilian-portuguese #- spanish #- swahili diff --git a/roles/transmission/tasks/main.yml b/roles/transmission/tasks/main.yml index 96d712814..a71f831ee 100644 --- a/roles/transmission/tasks/main.yml +++ b/roles/transmission/tasks/main.yml @@ -2,8 +2,8 @@ - name: Create Transmission download directory file: path: "{{ item }}" - owner: root - group: root + owner: "{{ transmission_user }}" + group: "{{ transmission_group }}" mode: 0755 state: directory with_items: @@ -27,8 +27,8 @@ src: "{{ item.src }}" dest: "{{ item.dest }}" mode: "{{ item.mode }}" - owner: root - group: root + owner: "{{ transmission_user }}" + group: "{{ transmission_group }}" with_items: - { src: 'settings.json.j2', dest: '/etc/transmission-daemon/settings.json', mode: '0644' } @@ -52,7 +52,6 @@ state: stopped when: not transmission_enabled - - name: Add transmission to list of services at /etc/iiab/iiab.ini ini_file: dest: "{{ service_filelist }}" diff --git a/roles/transmission/templates/settings.json.j2 b/roles/transmission/templates/settings.json.j2 index 03da5036b..d0c54402e 100644 --- a/roles/transmission/templates/settings.json.j2 +++ b/roles/transmission/templates/settings.json.j2 @@ -12,7 +12,7 @@ "blocklist-url": "http://www.example.com/blocklist", "cache-size-mb": 4, "dht-enabled": true, - "download-dir": {{ transmission_download_dir }}, + "download-dir": "{{ transmission_download_dir }}", "download-limit": 100, "download-limit-enabled": 0, "download-queue-enabled": true, @@ -29,7 +29,7 @@ "peer-id-ttl-hours": 6, "peer-limit-global": 200, "peer-limit-per-torrent": 50, - "peer-port": {{ transmission_peer_port }}, + "peer-port": {{ transmission_peer_port }}, "peer-port-random-high": 65535, "peer-port-random-low": 49152, "peer-port-random-on-start": false, @@ -48,11 +48,10 @@ "rpc-enabled": true, "rpc-host-whitelist": "", "rpc-host-whitelist-enabled": true, - "rpc-password": {{ transmission_password }}, - # TODO: BUG transmission_http_port is not assigned in settings.json? + "rpc-password": "{{ transmission_password }}", "rpc-port": {{ transmission_http_port }}, - "rpc-url": {{ transmission_url }}, - "rpc-username": {{ transmission_username }}, + "rpc-url": "{{ transmission_url }}", + "rpc-username": "{{ transmission_username }}", "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": true, "scrape-paused-torrents-enabled": true, From d6f475d57c8275743bb8aff50829a5df42f2a0bb Mon Sep 17 00:00:00 2001 From: Arky Date: Mon, 20 Aug 2018 16:27:41 +0700 Subject: [PATCH 15/16] Allow connections from localhost and local lan computers --- roles/transmission/templates/settings.json.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/transmission/templates/settings.json.j2 b/roles/transmission/templates/settings.json.j2 index d0c54402e..a7c31a1ee 100644 --- a/roles/transmission/templates/settings.json.j2 +++ b/roles/transmission/templates/settings.json.j2 @@ -52,7 +52,7 @@ "rpc-port": {{ transmission_http_port }}, "rpc-url": "{{ transmission_url }}", "rpc-username": "{{ transmission_username }}", - "rpc-whitelist": "127.0.0.1", + "rpc-whitelist": "127.0.0.1,192.168.*.*", "rpc-whitelist-enabled": true, "scrape-paused-torrents-enabled": true, "script-torrent-done-enabled": false, From be51c32a74ab0b99833f3ad89caa4a8b10fa6f10 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 20 Aug 2018 14:15:26 -0400 Subject: [PATCH 16/16] Proposed README.rst cleanups @arky please revert any of these changes/suggestions as necessary! --- roles/transmission/README.rst | 53 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/roles/transmission/README.rst b/roles/transmission/README.rst index f7680ee0f..12029afea 100644 --- a/roles/transmission/README.rst +++ b/roles/transmission/README.rst @@ -1,59 +1,62 @@ -===================== +=================== Transmission README -===================== -Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All its incarnations feature a very simple, intuitive - interface on top on an efficient, cross-platform back-end. +=================== -The transmission program is used to download and seed Ka-Lite packages. Once the packages are downloaded, Please verify the content -before copying them to Ka-Lite content directory. +Transmission is a set of lightweight BitTorrent clients (in GUI, CLI and daemon form). All these incarnations feature a very simple and intuitive interface, on top on an efficient, cross-platform back-end. + +Transmission is intended to download KA Lite content to IIAB, from places like http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ -- and also to seed it, in assistance of others. + +Once the packages are downloaded, please verify the content before copying it (carefully) to KA Lite content directory: /library/ka-lite/content Caution ------- -Usage of transmission consumes significant Internet data and system resources. -Caveat emptor! (That's Latin for "Buyer Beware"). + +Usage of Transmission consumes significant Internet data and system resources. +Caveat emptor! (That's Latin for "Buyer Beware") Access ------ -You can login transmission using its web interface http://box:9091/ with the following administration account. +Login to Transmission's web interface http://box:9091 using administrative account: Username: Admin Password: changeme -Alternatively you can also access transmission using the 'transmission-remote' or 'transmission-remote' on the command line. +Alternatively, you can type 'transmission-remote' at the command-line. Configuration --------------- -You can configure transmission using the web interface http://box:9091. +------------- -You can also edit the transmission settings in '/etc/transmission-daemon/settings.json'. Before you start editing the -'settings.json' file, Please ensure that transmission-daemon.service is stop. +You can configure Transmission using its web interface http://box:9091 + +You can also edit Transmission settings in '/etc/transmission-daemon/settings.json'. Before you start editing the +'settings.json' file, please ensure that transmission-daemon.service is stopped: $ sudo systemctl stop transmission-daemon.service -$ sudo nano /etc/transmission-daemon/settings.json +$ sudo nano /etc/transmission-daemon/settings.json Adding torrents --------------- -The transmission provisioning system is designed to add ka-Lite packages. You can also use transmission is -download torrent using the Transmission web interface or using 'transmission-remote' program. + +Transmission can facilitate provisioning your IIAB, by adding KA Lite content from places like: http://pantry.learningequality.org/downloads/ka-lite/0.17/content/ + +You can also download other torrents using Transmission's web interface, or by typing 'transmission-remote' at the command-line. $ transmission-remote -a Known Issues -------------- -* Default Transmission user/group (See https://github.com/transmission/transmission/issues/537) -Currently you need to set these these in "transmission_user" and "transmission_group" variables. You can check -the value for these in transmission-daemon systemd unit file "lib/systemd/system/transmission-daemon.service" -* Random Ports -Currently it is not possible to use random ports in the range 65535-49152. It is difficult to open multiple ports in IIAB firewall. +------------ +* Default Transmission user/group (See https://github.com/transmission/transmission/issues/537). Currently you need to set these "transmission_user" and "transmission_group" variables. Check their values in transmission-daemon's systemd unit file: lib/systemd/system/transmission-daemon.service + +* 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. Troubleshooting ----------------- +--------------- Please check if the transmission daemon is running: $ sudo systemctl status transmission-daemon.service -Check the transmission settings '/etc/transmission-daemon/settings.json' are correct. +Check that Transmission's settings are correct in: /etc/transmission-daemon/settings.json