add deluge role

This commit is contained in:
Clément Désiles
2026-09-18 15:24:18 +02:00
parent 30480f61d5
commit 501671770f
8 changed files with 346 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=Deluge BitTorrent Client
[Service]
Type=notify
NotifyAccess=all
WorkingDirectory={{ podman_projects_dir | default('/opt/podman') }}/deluge
ExecStart=/usr/bin/podman kube play --replace --service-container=true --network=pasta:--map-host-loopback={{ podman_gw_gateway }} deluge.yaml
ExecStop=/usr/bin/podman kube down deluge.yaml
Restart=on-failure
RestartSec=10
TimeoutStartSec=180
[Install]
WantedBy=default.target
+60
View File
@@ -0,0 +1,60 @@
---
apiVersion: v1
kind: Pod
metadata:
name: deluge
labels:
app: deluge
spec:
containers:
- name: deluge
image: {{ deluge_image }}:{{ deluge_version }}
ports:
- containerPort: {{ deluge_web_port }}
hostPort: {{ deluge_web_port }}
- containerPort: {{ deluge_torrent_port }}
hostPort: {{ deluge_torrent_port }}
- containerPort: {{ deluge_torrent_port }}
hostPort: {{ deluge_torrent_port }}
protocol: UDP
env:
- name: PUID
value: "{{ ansible_facts['getent_passwd'][ansible_user][1] }}"
- name: PGID
value: "{{ ansible_facts['getent_passwd'][ansible_user][2] }}"
- name: TZ
value: "{{ deluge_timezone }}"
- name: DELUGE_LOGLEVEL
value: "{{ deluge_loglevel }}"
- name: UMASK
value: "022"
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
- name: config
mountPath: /config
- name: downloads
mountPath: /downloads
livenessProbe:
tcpSocket:
port: {{ deluge_web_port }}
initialDelaySeconds: 60
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
restartPolicy: Never
volumes:
- name: localtime
hostPath:
path: /etc/localtime
type: File
- name: config
hostPath:
path: {{ deluge_config_dir }}
type: Directory
- name: downloads
hostPath:
path: {{ deluge_downloads_dir }}
type: Directory
@@ -0,0 +1,58 @@
# Deluge vhost with Let's Encrypt (Certbot)
# Managed by Ansible - DO NOT EDIT MANUALLY
server {
listen 80;
listen [::]:80;
server_name {{ deluge_nginx_hostname }};
# Certbot webroot for ACME challenges
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
# Redirect to HTTPS
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name {{ deluge_nginx_hostname }};
# Let's Encrypt certificates (managed by Certbot)
ssl_certificate /etc/letsencrypt/live/{{ deluge_nginx_hostname }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ deluge_nginx_hostname }}/privkey.pem;
# SSL configuration
ssl_protocols {{ nginx_ssl_protocols | default('TLSv1.3') }};
ssl_prefer_server_ciphers on;
{% if nginx_log_backend | default('journald') == 'journald' %}
access_log syslog:server=unix:/dev/log,nohostname,tag=nginx_deluge;
error_log syslog:server=unix:/dev/log,nohostname,tag=nginx_deluge;
{% else %}
access_log /var/log/nginx/{{ deluge_nginx_hostname }}_access.log main;
error_log /var/log/nginx/{{ deluge_nginx_hostname }}_error.log;
{% endif %}
client_max_body_size 20M;
location / {
proxy_pass http://127.0.0.1:{{ deluge_web_port }};
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support for real-time UI updates
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_buffering off;
proxy_read_timeout 3600s;
}
}