Add Ansible role for Deluge

This commit is contained in:
Joakim Soderlund 2018-07-29 22:05:38 +02:00
parent b65c0f652a
commit c31bbc8e6e
9 changed files with 228 additions and 0 deletions

View file

@ -0,0 +1,10 @@
---
#
# Deluge defaults.
#
deluge:
user: debian-deluged
home: /var/lib/deluged
conf: /var/lib/deluged/config
auth: tunnel:tunnel:10

View file

@ -0,0 +1,11 @@
---
#
# Deluge handlers.
#
- name: Restart Deluge
systemd:
name: deluged
enabled: yes
daemon_reload: yes
state: restarted

View file

@ -0,0 +1,38 @@
---
#
# Configures Deluge.
#
- name: Create config directory
file:
path: "{{ deluge.conf }}"
mode: 0755
owner: "{{ deluge.user }}"
group: "{{ deluge.user }}"
state: directory
- name: Configure daemon
template:
src: config
dest: "{{ deluge.conf }}/core.conf"
mode: 0644
owner: root
group: "{{ deluge.user }}"
notify: Restart Deluge
- name: Configure authentication
lineinfile:
line: "{{ deluge.auth }}"
dest: "{{ deluge.conf }}/auth"
mode: 0640
owner: root
group: "{{ deluge.user }}"
create: yes
state: present
notify: Restart Deluge
- name: Install service
template:
src: service
dest: /etc/systemd/system/deluged.service
notify: Restart Deluge

View file

@ -0,0 +1,13 @@
---
#
# Deluge tasks.
#
- name: Prepare system
include: prep.yml
- name: Install Deluge
include: make.yml
- name: Configure Deluge
include: conf.yml

View file

@ -0,0 +1,9 @@
---
#
# Builds and installs Deluge.
#
- name: Install Deluge
apt:
name: deluged
state: present

View file

@ -0,0 +1,20 @@
---
#
# Prepares system for Deluge.
#
- name: Create UNIX group
group:
name: "{{ deluge.user }}"
system: yes
state: present
- name: Create UNIX user
user:
name: "{{ deluge.user }}"
group: "{{ deluge.user }}"
home: "{{ deluge.home }}"
createhome: yes
skeleton: yes
system: yes
state: present

View file

@ -0,0 +1,101 @@
{
"file": 1,
"format": 1
}{
"info_sent": 0.0,
"lsd": false,
"max_download_speed": -1.0,
"send_info": false,
"natpmp": false,
"move_completed_path": "{{ deluge.home }}/storage",
"peer_tos": "0x00",
"enc_in_policy": 1,
"queue_new_to_top": false,
"ignore_limits_on_local_network": true,
"rate_limit_ip_overhead": false,
"daemon_port": 58846,
"torrentfiles_location": "{{ deluge.home }}/torrents",
"max_active_limit": -1,
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
"upnp": false,
"utpex": true,
"max_active_downloading": -1,
"max_active_seeding": -1,
"allow_remote": false,
"outgoing_ports": [
0,
0
],
"enabled_plugins": [],
"max_half_open_connections": -1,
"download_location": "{{ deluge.home }}/storage",
"compact_allocation": false,
"max_upload_speed": -1.0,
"plugins_location": "{{ deluge.home }}/plugins",
"max_connections_global": -1,
"enc_prefer_rc4": true,
"cache_expiry": 28800,
"dht": true,
"stop_seed_at_ratio": false,
"stop_seed_ratio": -1.0,
"max_download_speed_per_torrent": -1,
"prioritize_first_last_pieces": false,
"max_upload_speed_per_torrent": -1,
"auto_managed": true,
"enc_level": 2,
"copy_torrent_file": true,
"max_connections_per_second": -1,
"listen_ports": [
6881,
6891
],
"max_connections_per_torrent": -1,
"del_copy_torrent_file": false,
"move_completed": false,
"autoadd_enable": false,
"proxies": {
"peer": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"web_seed": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"tracker": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"dht": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
}
},
"dont_count_slow_torrents": false,
"add_paused": false,
"random_outgoing_ports": true,
"max_upload_slots_per_torrent": -1,
"new_release_check": false,
"enc_out_policy": 1,
"seed_time_ratio_limit": -1.0,
"remove_seed_at_ratio": false,
"autoadd_location": "{{ deluge.home }}/watch",
"max_upload_slots_global": -1,
"seed_time_limit": -1,
"cache_size": 16384,
"share_ratio_limit": -1.0,
"random_port": true,
"listen_interface": ""
}

View file

@ -0,0 +1,16 @@
[Unit]
Description=Deluge Daemon
Documentation=man:deluged
After=network-online.target
[Service]
Type=simple
User={{ deluge.user }}
Group={{ deluge.user }}
UMask=002
ExecStart=/usr/bin/deluged -c {{ deluge.conf }} -d
Restart=on-failure
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target

10
operations/seeder.yml Normal file
View file

@ -0,0 +1,10 @@
---
#
# Configures seeders.
#
- name: Seeder
hosts: seeders
roles:
- common
- deluge