1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00

*, rtorrent: initial commit

This commit is contained in:
Matt Layher 2016-04-15 20:32:33 -04:00
commit d6cbefbf62
No known key found for this signature in database
GPG key ID: 77BFE531397EDE94
4 changed files with 99 additions and 0 deletions

10
LICENSE.md Normal file
View file

@ -0,0 +1,10 @@
MIT License
===========
Copyright (C) 2016 Matt Layher
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

5
README.md Normal file
View file

@ -0,0 +1,5 @@
ansible
=======
Ansible playbooks used to configure Matt Layher's machines.
MIT Licensed.

View file

@ -0,0 +1,48 @@
# {{ ansible_managed }}
# rtorrent configuration, Matt Layher, 2016-04-15
#
# Dynamic configurations.
#
# Configure global upload and download rates in KiB. "0" is unlimited.
download_rate = {{ rtorrent_download_rate }}
upload_rate = {{ rtorrent_upload_rate }}
# Listen on a single port.
port_range = {{ rtorrent_port }}-{{ rtorrent_port }}
port_random = no
# Files and session directory configurations.
directory = {{ rtorrent_path_files }}
session = {{ rtorrent_path_session }}
# Watch directory configuration.
schedule = watch_directory,5,5,load_start="{{ rtorrent_path_watch }}/*.torrent"
schedule = untied_directory,5,5,stop_untied=
schedule = tied_directory,5,5,start_tied=
# Halt further downloads when disk space is low.
schedule = low_diskspace,5,60,close_low_diskspace={{ rtorrent_low_diskspace }}
# Delete file data when a torrent is removed.
system.method.set_key = event.download.erased,remove_erased,"execute=rm,-rf,--,$d.get_base_path={{ rtorrent_path_files }}"
{% if rtorrent_scgi_port is defined %}
# SCGI interface configuration.
scgi_port = {{ rtorrent_scgi_port }}
{% endif %}
#
# Static configurations.
#
# Check hash on completed torrents.
check_hash = yes
# Use encryption whenever possible.
encryption = allow_incoming,try_outgoing,enable_retry
# Disable DHT and peer exchange.
dht = disable
peer_exchange = no

View file

@ -0,0 +1,36 @@
---
- hosts: rtorrent
vars:
# Client configurations
- rtorrent_port: 58575
- rtorrent_download_rate: 10000
- rtorrent_upload_rate: 400
- rtorrent_low_diskspace: "1G"
# Path configurations
- rtorrent_path_root: "/mnt/rtorrent"
- rtorrent_path_files: "{{ rtorrent_path_root }}/files"
- rtorrent_path_session: "{{ rtorrent_path_root }}/.session"
- rtorrent_path_watch: "{{ rtorrent_path_root }}/watch"
tasks:
- name: install rtorrent
apt: pkg=rtorrent state=installed
register: rtorrentinstalled
- name: fail the play if rtorrent could not be installed
when: rtorrentinstalled|failed
fail: msg="failed to install rtorrent"
- name: create rtorrent user
user: name=rtorrent shell=/bin/false comment="rtorrent service user"
- name: create rtorrent configuration
template: src=rtorrent.rc.j2 dest=/home/rtorrent/.rtorrent.rc owner=rtorrent group=rtorrent mode=0755
- name: create files directory
file: path={{ rtorrent_path_files }} state=directory owner=rtorrent group=rtorrent mode=0755
- name: create watch directory
file: path={{ rtorrent_path_watch }} state=directory owner=rtorrent group=rtorrent mode=0755
- name: create session directory
file: path={{ rtorrent_path_session }} state=directory owner=rtorrent group=rtorrent mode=0755