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.
This commit is contained in:
88
roles/aria2/tasks/main.yml
Normal file
88
roles/aria2/tasks/main.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user