aria2: Deploy aria2 download manager
The *aria2* role installs the *aria2* download manager and sets it up to run as a system service with RPC enabled. It also sets up the web UI, though that must be installed manually from an archive, for now.jenkins-master
parent
895974f346
commit
88dd80e6fd
|
@ -0,0 +1,9 @@
|
||||||
|
- hosts: aria2
|
||||||
|
roles:
|
||||||
|
- apache
|
||||||
|
- aria2
|
||||||
|
tasks:
|
||||||
|
- name: ensure apache is running
|
||||||
|
service:
|
||||||
|
name=httpd
|
||||||
|
state=started
|
|
@ -0,0 +1,2 @@
|
||||||
|
aria2_download_dir: /srv/cifs/Downloads/00aria2
|
||||||
|
aria2_webui_host: files.pyrocufflink.blue
|
3
hosts
3
hosts
|
@ -4,6 +4,9 @@ ansible_python_interpreter=/usr/bin/python3
|
||||||
[ansible]
|
[ansible]
|
||||||
cm0.pyrocufflink.blue
|
cm0.pyrocufflink.blue
|
||||||
|
|
||||||
|
[aria2]
|
||||||
|
file0.pyrocufflink.blue
|
||||||
|
|
||||||
[burp-client]
|
[burp-client]
|
||||||
file0.pyrocufflink.blue
|
file0.pyrocufflink.blue
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
aria2_download_dir: /var/lib/aria2/downloads
|
||||||
|
aria2_listen_ports: 16881-16999
|
||||||
|
aria2_dht_listen_ports: 6881-6999
|
||||||
|
aria2_webui_host: '{{ ansible_fqdn }}'
|
|
@ -0,0 +1,5 @@
|
||||||
|
Alias /aria2 /var/lib/aria2/webui
|
||||||
|
|
||||||
|
<Location /aria2>
|
||||||
|
Require all granted
|
||||||
|
</Location>
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=aria2 Download Manager
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=aria2
|
||||||
|
Group=aria2
|
||||||
|
ExecStart=/usr/bin/aria2c --daemon=false --conf-path=/etc/aria2.conf --log=-
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,12 @@
|
||||||
|
- name: reload systemd
|
||||||
|
command: systemctl daemon-reload
|
||||||
|
- name: restart aria2
|
||||||
|
service:
|
||||||
|
name=aria2
|
||||||
|
state=restarted
|
||||||
|
- name: reload httpd
|
||||||
|
service:
|
||||||
|
name=httpd
|
||||||
|
state=reloaded
|
||||||
|
- name: save firewalld configuration
|
||||||
|
command: firewalld --runtime-to-permanent
|
|
@ -0,0 +1,88 @@
|
||||||
|
- name: ensure aria2 is installed
|
||||||
|
package:
|
||||||
|
name=aria2
|
||||||
|
state=present
|
||||||
|
tags:
|
||||||
|
- install
|
||||||
|
|
||||||
|
- name: ensure aria2 group exists
|
||||||
|
group:
|
||||||
|
name=aria2
|
||||||
|
system=yes
|
||||||
|
state=present
|
||||||
|
tags:
|
||||||
|
- group
|
||||||
|
- user
|
||||||
|
- name: ensure aria2 user exists
|
||||||
|
user:
|
||||||
|
name: aria2
|
||||||
|
group: aria2
|
||||||
|
comment: aria2 Download Manager
|
||||||
|
home: /var/lib/aria2
|
||||||
|
createhome: true
|
||||||
|
shell: /sbin/nologin
|
||||||
|
system: true
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: ensure aria2 is configured
|
||||||
|
template:
|
||||||
|
src=aria2.conf.j2
|
||||||
|
dest=/etc/aria2.conf
|
||||||
|
mode=0644
|
||||||
|
notify: restart aria2
|
||||||
|
|
||||||
|
- name: ensure aria2 download directory exists
|
||||||
|
file:
|
||||||
|
path={{ aria2_download_dir }}
|
||||||
|
owner=aria2
|
||||||
|
group=aria2
|
||||||
|
mode=755
|
||||||
|
state=directory
|
||||||
|
|
||||||
|
- name: ensure aria2 state file exists
|
||||||
|
copy:
|
||||||
|
dest=/var/lib/aria2/aria2.state
|
||||||
|
content=
|
||||||
|
force=no
|
||||||
|
|
||||||
|
- name: ensure aria2 systemd unit exists
|
||||||
|
copy:
|
||||||
|
src=aria2.service
|
||||||
|
dest=/etc/systemd/system/aria2.service
|
||||||
|
mode=0644
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- name: ensure firewall is configured for aria2
|
||||||
|
firewalld:
|
||||||
|
port: '{{ item }}'
|
||||||
|
permanent: false
|
||||||
|
immediate: true
|
||||||
|
state: enabled
|
||||||
|
with_items:
|
||||||
|
- 6800/tcp
|
||||||
|
- '{{ aria2_listen_ports }}/tcp'
|
||||||
|
- '{{ aria2_dht_listen_ports }}/tcp'
|
||||||
|
notify: save firewalld configuration
|
||||||
|
|
||||||
|
- name: ensure aria2 service starts at boot
|
||||||
|
service:
|
||||||
|
name=aria2
|
||||||
|
enabled=yes
|
||||||
|
- meta: flush_handlers
|
||||||
|
- name: ensure aria2 service is running
|
||||||
|
service:
|
||||||
|
name=aria2
|
||||||
|
state=started
|
||||||
|
|
||||||
|
- name: ensure aria2 web ui is configured
|
||||||
|
template:
|
||||||
|
src=configuration.js.j2
|
||||||
|
dest=/var/lib/aria2/webui/configuration.js
|
||||||
|
mode=0644
|
||||||
|
|
||||||
|
- name: ensure apache is configured to serve aria2 web ui
|
||||||
|
copy:
|
||||||
|
src=aria2.httpd.conf
|
||||||
|
dest=/etc/httpd/conf.d/aria2.conf
|
||||||
|
mode=0644
|
||||||
|
notify: reload httpd
|
|
@ -0,0 +1,17 @@
|
||||||
|
dir={{ aria2_download_dir }}
|
||||||
|
bt-exclude-tracker=*
|
||||||
|
bt-prioritize-piece=head,tail
|
||||||
|
bt-require-crypto=true
|
||||||
|
dht-listen-port={{ aria2_dht_listen_ports }}
|
||||||
|
dht-entry-point=dht.transmissionbt.com:6881
|
||||||
|
dht-file-path=/var/lib/aria2/dht.dat
|
||||||
|
dht-file-path6=/var/lib/aria2/dht6.dat
|
||||||
|
listen-port={{ aria2_listen_ports }}
|
||||||
|
enable-rpc=true
|
||||||
|
rpc-listen-all=true
|
||||||
|
log=/var/log/aria2.log
|
||||||
|
log-level=notice
|
||||||
|
continue
|
||||||
|
save-session=/var/lib/aria2/aria2.state
|
||||||
|
input-file=/var/lib/aria2/aria2.state
|
||||||
|
save-session-interval=10
|
|
@ -0,0 +1,46 @@
|
||||||
|
angular
|
||||||
|
.module('webui.services.configuration', [])
|
||||||
|
.constant('$name', 'Aria2 WebUI') // name used across the entire UI
|
||||||
|
.constant('$titlePattern', 'active: {active} - waiting: {waiting} - stopped: {stopped} — {name}')
|
||||||
|
.constant('$pageSize', 11) // number of downloads shown before pagination kicks in
|
||||||
|
.constant('$authconf', { // default authentication configuration, never fill it in case the webui is hosted in public IP as it can be compromised
|
||||||
|
host: location.protocol.startsWith('http') ? location.hostname : 'localhost',
|
||||||
|
path: '/jsonrpc',
|
||||||
|
port: 6800,
|
||||||
|
encrypt: false,
|
||||||
|
auth: { // either add the token field or the user and pass field, not both.
|
||||||
|
// token: '$YOUR_SECRET_TOKEN$'
|
||||||
|
/*-----------------------------*/
|
||||||
|
// user: '*YOUR_USERNAME*',
|
||||||
|
// pass: '*YOUR_SECRET_PASS*'
|
||||||
|
},
|
||||||
|
directURL: '' // If supplied, links will be created to enable direct download from the aria2 server, requires appropriate webserver to be configured
|
||||||
|
})
|
||||||
|
.constant('$enable', {
|
||||||
|
|
||||||
|
torrent: true, // bittorrent support only enabled if supported by aria2 build, set to false otherwise to permanently disable it
|
||||||
|
|
||||||
|
metalink: true, // metalink support only enabled if supported by aria2 build, set to false to permanently disable it
|
||||||
|
|
||||||
|
sidebar: { // configuration related to the sidebar next to the list of downloads
|
||||||
|
show: true, // set to false to completely hide the sidebar. Other elements inside will be automatically hidden
|
||||||
|
|
||||||
|
stats: true, // set to false to hide the global statistic section (contains the speed graph for now)
|
||||||
|
|
||||||
|
filters: true, // set to false to hide the Download Filters
|
||||||
|
|
||||||
|
starredProps: true // only shown when at least one property is added to the starred list, set to false to permanently hide the Quick Access Settings inside the sidebar
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.constant('$starredProps', [ // default list of Quick Access Properties. Can be overridden by making modification through the Global Settings dialog
|
||||||
|
// go to Global Settings dialog to see their description
|
||||||
|
'dir', 'conf-path', 'auto-file-renaming', 'max-connection-per-server'
|
||||||
|
])
|
||||||
|
.constant('$downloadProps', [ // Similar to starred Quick Access properties but for adding new downloads.
|
||||||
|
// go to Advance Download Options when adding a new download to view the list of possible options
|
||||||
|
'header', 'http-user', 'http-passwd', 'pause', 'dir', 'max-connection-per-server'
|
||||||
|
])
|
||||||
|
.constant('$globalTimeout', 1000) // interval to update the individual downloads
|
||||||
|
;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue