This commit is contained in:
LooseSeal2
2019-07-29 17:13:53 -07:00
parent 9c23a08a61
commit bc553ab818
6 changed files with 241 additions and 10 deletions

View File

@@ -12,7 +12,7 @@
# FACTS ####################################################################### # FACTS #######################################################################
- name: 'Set Known Facts' - name: 'Set Known Facts'
set_fact: set_fact:
pgrole: 'deluge' pgrole: 'deluge-vpn'
intport: '8112' intport: '8112'
extport: '8112' extport: '8112'
intport2: '8118' intport2: '8118'
@@ -161,7 +161,7 @@
lineinfile: lineinfile:
path: '/opt/appdata/{{pgrole}}/plugins/extractor.conf' path: '/opt/appdata/{{pgrole}}/plugins/extractor.conf'
regexp: '"extract_path".*' regexp: '"extract_path".*'
line: '"extract_path": "{{path.stdout}}/downloads/deluge"' line: '"extract_path": "{{path.stdout}}/downloads/{{pgrole}}"'
state: present state: present
# FIRST TIME CONFIGURATION #################################################### # FIRST TIME CONFIGURATION ####################################################

View File

@@ -151,7 +151,7 @@
lineinfile: lineinfile:
path: '/opt/appdata/{{pgrole}}/plugins/extractor.conf' path: '/opt/appdata/{{pgrole}}/plugins/extractor.conf'
regexp: '"extract_path".*' regexp: '"extract_path".*'
line: '"extract_path": "{{path.stdout}}/downloads/deluge"' line: '"extract_path": "{{path.stdout}}/downloads/{{pgrole}}"'
state: present state: present
# FIRST TIME CONFIGURATION #################################################### # FIRST TIME CONFIGURATION ####################################################

View File

@@ -13,7 +13,7 @@
- name: 'Set Known Facts' - name: 'Set Known Facts'
set_fact: set_fact:
pgrole: 'jd2-openvpn' pgrole: 'jdownloader2-vpn'
intport: '5800' intport: '5800'
extport: '5802' extport: '5802'
intport2: '5902' intport2: '5902'

View File

@@ -13,7 +13,7 @@
- name: 'Set Known Facts' - name: 'Set Known Facts'
set_fact: set_fact:
pgrole: 'qbittorrent' pgrole: 'qbittorrent-vpn'
intport: '8080' intport: '8080'
extport: '8098' extport: '8098'
intport2: '8118' intport2: '8118'

View File

@@ -28,10 +28,10 @@
- name: 'Including folders' - name: 'Including folders'
include_tasks: '/opt/communityapps/apps/_downloaders.yml' include_tasks: '/opt/communityapps/apps/_downloaders.yml'
- name: 'Ini Check' - name: Checking for existing app data
stat: stat:
path: /opt/appdata/{{pgrole}}/core.conf path: '/opt/appdata/{{pgrole}}/rutorrent/rtorrent/rtorrent.rc'
register: inicheck register: rccheck
# LABELS ###################################################################### # LABELS ######################################################################
- name: 'Adding Traefik' - name: 'Adding Traefik'
@@ -84,3 +84,234 @@
privileged: yes privileged: yes
state: started state: started
labels: '{{pg_labels}}' 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

View File

@@ -3,5 +3,5 @@
"format": 1 "format": 1
}{ }{
"use_name_folder": true, "use_name_folder": true,
"extract_path": "/downloads/deluge/" "extract_path": "/mnt/downloads/{{pgrole}}/"
} }