|
|
|
|
@@ -27,11 +27,11 @@
|
|
|
|
|
|
|
|
|
|
- name: 'Including folders'
|
|
|
|
|
include_tasks: '/opt/communityapps/apps/_downloaders.yml'
|
|
|
|
|
|
|
|
|
|
- name: 'Ini Check'
|
|
|
|
|
|
|
|
|
|
- name: Checking for existing app data
|
|
|
|
|
stat:
|
|
|
|
|
path: /opt/appdata/{{pgrole}}/core.conf
|
|
|
|
|
register: inicheck
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rutorrent/rtorrent/rtorrent.rc'
|
|
|
|
|
register: rccheck
|
|
|
|
|
|
|
|
|
|
# LABELS ######################################################################
|
|
|
|
|
- name: 'Adding Traefik'
|
|
|
|
|
@@ -84,3 +84,234 @@
|
|
|
|
|
privileged: yes
|
|
|
|
|
state: started
|
|
|
|
|
labels: '{{pg_labels}}'
|
|
|
|
|
|
|
|
|
|
# CONFIGURATION ####################################################
|
|
|
|
|
- name: 'Waiting for {{pgrole}} to initialize'
|
|
|
|
|
wait_for:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
state: present
|
|
|
|
|
msg: rtorrent.rc creation failed
|
|
|
|
|
|
|
|
|
|
- name: 'Stopping {{pgrole}}'
|
|
|
|
|
docker_container:
|
|
|
|
|
name: '{{pgrole}}'
|
|
|
|
|
state: stopped
|
|
|
|
|
|
|
|
|
|
# This is needed for rutorrent b/c it's weird.
|
|
|
|
|
- name: 'Setting ownership on appdata recursivley (this can take a while!)'
|
|
|
|
|
shell: 'chown -R 1000:1000 /opt/appdata/{{pgrole}}'
|
|
|
|
|
|
|
|
|
|
- name: 'Setting permissions on appdata recursivley (this can take a while!)'
|
|
|
|
|
shell: 'chmod -R 775 /opt/appdata/{{pgrole}}'#*check_hash\s*=.*'
|
|
|
|
|
|
|
|
|
|
- name: Set download location
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*directory\s*=.*'
|
|
|
|
|
line: 'directory = {{path.stdout}}/downloads/{{pgrole}}'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Set download location
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*directory.default.set\s*=.*'
|
|
|
|
|
line: 'directory.default.set = {{path.stdout}}/downloads/{{pgrole}}'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
# - name: Set download completed move location
|
|
|
|
|
# lineinfile:
|
|
|
|
|
# path: "/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc"
|
|
|
|
|
# regexp: '#*method.insert\s*=\s*d.get_finished_dir.*'
|
|
|
|
|
# line: 'method.insert = d.get_finished_dir, simple, "cat={path.stdout}}/downloads/{{pgrole}}/,$d.custom1="'
|
|
|
|
|
# state: present
|
|
|
|
|
|
|
|
|
|
# - name: Set download data path location
|
|
|
|
|
# lineinfile:
|
|
|
|
|
# path: "/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc"
|
|
|
|
|
# regexp: '#*method.insert\s*=\s*d.data_path.*'
|
|
|
|
|
# line: 'method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"'
|
|
|
|
|
# state: present
|
|
|
|
|
|
|
|
|
|
# - name: Enable download completed move
|
|
|
|
|
# lineinfile:
|
|
|
|
|
# path: "/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc"
|
|
|
|
|
# regexp: '#*method.insert\s*=\s*d.move_to_complete,\s*simple.*'
|
|
|
|
|
# line: 'method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="'
|
|
|
|
|
# state: present
|
|
|
|
|
|
|
|
|
|
# - name: Enable download completed move event
|
|
|
|
|
# lineinfile:
|
|
|
|
|
# path: "/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc"
|
|
|
|
|
# regexp: '#*method.set_key\s*=\s*event.download.finished,move_complete.*'
|
|
|
|
|
# line: 'method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="'
|
|
|
|
|
# state: present
|
|
|
|
|
|
|
|
|
|
# FIRST TIME CONFIGURATION ####################################################
|
|
|
|
|
- name: 'Configuring {{pgrole}} for first time use'
|
|
|
|
|
block:
|
|
|
|
|
- name: Upload Rate
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*upload_rate\s*=.*'
|
|
|
|
|
line: 'upload_rate = 100000'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Download Rate
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*download_rate\s*=.*'
|
|
|
|
|
line: 'download_rate = 100000'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: max_downloads
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*throttle.max_downloads.global.set\s*=.*'
|
|
|
|
|
line: 'throttle.max_downloads.global.set = 500'
|
|
|
|
|
state: present
|
|
|
|
|
- name: max_uploads
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*throttle.max_uploads.global.set\s*=.*'
|
|
|
|
|
line: 'throttle.max_uploads.global.set = 50'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: No File Allocation
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*system.file.allocate.set\s*=.*'
|
|
|
|
|
line: 'system.file.allocate.set = 0'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: min_peers
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*min_peers\s*=.*'
|
|
|
|
|
line: 'min_peers = 40'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: max_peers
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*max_peers\s*=.*'
|
|
|
|
|
line: 'max_peers = 1200'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: max_uploads
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*max_uploads\s*=.*'
|
|
|
|
|
line: 'max_uploads = 15'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: max_downloads
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*max_downloads\s*=.*'
|
|
|
|
|
line: 'max_downloads = 10'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Upload Rate
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*upload_rate\s*=.*'
|
|
|
|
|
line: 'upload_rate = 30000'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Download Rate
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*download_rate\s*=.*'
|
|
|
|
|
line: 'download_rate = 90000'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Global Upload to Unlmited
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*throttle.global_up.max_rate.set_kb\s*=.*'
|
|
|
|
|
line: 'throttle.global_up.max_rate.set_kb = 0'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: DHT disable
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*dht\s*=.*'
|
|
|
|
|
line: '#dht = auto'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: DHT port
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*dht_port\s*=.*'
|
|
|
|
|
line: '#dht_port = 6881'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: check Hash
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*check_hash\s*=.*'
|
|
|
|
|
line: 'check_hash = no'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Preload Piece to Host
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*pieces.preload.type\s*=.*'
|
|
|
|
|
line: 'pieces.preload.type = 2'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: lower DNS timeout
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*network.http.dns_cache_timeout.set\s*=.*'
|
|
|
|
|
line: 'network.http.dns_cache_timeout.set = 25'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Network Send Buffer Size
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*network.send_buffer.size.set\s*=.*'
|
|
|
|
|
line: 'network.send_buffer.size.set = 12M'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Network Recived Buffer Size
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*network.receive_buffer.size.set\s*=.*'
|
|
|
|
|
line: 'network.receive_buffer.size.set = 4M'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Announce-Interval Min rescan
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*throttle.min_peers.seed.set\s*=.*'
|
|
|
|
|
line: 'throttle.min_peers.seed.set = 0'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Announce-Interval Max rescan
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rtorrent/rtorrent.rc'
|
|
|
|
|
regexp: '#*throttle.max_peers.seed.set\s*=.*'
|
|
|
|
|
line: 'throttle.max_peers.seed.set = -1'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: Do not save uploaded Torrents
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rutorrent/settings/config.php'
|
|
|
|
|
regexp: '\$saveUploadedTorrents\s*=.*'
|
|
|
|
|
line: '$saveUploadedTorrents = false;'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
- name: overwrite uploaded Torrents
|
|
|
|
|
lineinfile:
|
|
|
|
|
path: '/opt/appdata/{{pgrole}}/rutorrent/settings/config.php'
|
|
|
|
|
regexp: '\$overwriteUploadedTorrents\s*=.*'
|
|
|
|
|
line: '$overwriteUploadedTorrents = true;'
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
|
|
when: not rccheck.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: Restart Docker Container
|
|
|
|
|
docker_container:
|
|
|
|
|
name: '{{pgrole}}'
|
|
|
|
|
state: started
|
|
|
|
|
|