Skip to content

Commit 0cbd9b3

Browse files
authored
support more variables, general fixes (#9)
* templates: move to ansible_managed * readme: update with new variables * defaults: add new variables, move fail2ban defaults from template to defaults file * templates/config: add support for optional vars, rearrange config file, fix #3 * .ansible-lint: remove skipping yaml line-length, add production profile * defaults: remove blank line to make ansible-lint happy
1 parent a991375 commit 0cbd9b3

7 files changed

Lines changed: 81 additions & 67 deletions

File tree

.ansible-lint

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
skip_list:
2-
- yaml[line-length]
1+
profile: production

README.md

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,87 @@ Ansible role to install and configure [Jellyfin](https://jellyfin.org/) on Debia
55
![push-galaxy](https://github.com/sleepy-nols/ansible-jellyfin/actions/workflows/ansible-galaxy-push-role.yml/badge.svg)
66
![Ansible ](https://img.shields.io/badge/Ansible_Galaxy-sleepy--nols.jellyfin-blue?url=https://galaxy.ansible.com/api/v2/collections/ibm/ibm_zos_core/&query=latest_version.version)
77

8+
9+
---
810
## Role Variables and Defaults
911

10-
User that Jellyfin runs as.
1112
```yml
1213
jellyfin_user: "jellyfin"
1314
```
14-
Skip restarting Jellyfin, even on config change.
15+
User that Jellyfin runs as.
16+
1517
```yml
1618
jellyfin_skip_restart: false
1719
```
18-
Enable fail2ban integration for the Jellyfin login.
20+
Skip restarting Jellyfin, even on config change.
21+
22+
### fail2ban
23+
1924
```yml
2025
jellyfin_enable_fail2ban: false
2126
```
22-
Set these if you use custom ports for Jellyfin.
27+
Enable fail2ban integration for the Jellyfin login.
28+
2329
```yml
2430
jellyfin_fail2ban_ports:
2531
- "80"
2632
- "443"
2733
```
28-
Configuration of fail2ban parameters. You probably want to tweak these according to your userbase and threatmodel.
34+
Set these if you use custom ports for Jellyfin.
35+
2936
```yml
3037
jellyfin_fail2ban_maxretry: "3"
3138
jellyfin_fail2ban_bantime: "6000"
3239
jellyfin_fail2ban_findtime: "600"
3340
```
41+
Configuration of fail2ban parameters. You probably want to tweak these according to your userbase and threatmodel.
42+
43+
### Jellyfin
44+
45+
```yml
46+
jellyfin_cache_dir: "/var/cache/jellyfin"
47+
jellyfin_log_dir: "/var/log/jellyfin"
48+
jellyfin_config_dir: "/etc/jellyfin"
49+
jellyfin_data_dir: "/var/lib/jellyfin"
50+
```
51+
Jellyfin directories.
3452
35-
Additional Jellyfin options as in [Main Configuration Options](https://jellyfin.org/docs/general/administration/configuration#main-configuration-options)
3653
```yml
37-
jellyfin_additional_opts: ""
54+
jellyfin_restart_bin: "/usr/lib/jellyfin/restart.sh"
55+
jellyfin_ffmpeg_bin: "/usr/lib/jellyfin-ffmpeg/ffmpeg"
56+
jellyfin_web_bin: "/usr/share/jellyfin/web"
3857
```
58+
Jellyfin binary paths.
3959
4060
41-
Jellyfin Paths
4261
```yml
43-
jellyfin_restart_opt: "--restartpath=/usr/lib/jellyfin/restart.sh"
44-
jellyfin_ffmpeg_opt: "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg"
45-
jellyfin_web_opt: "--webdir=/usr/share/jellyfin/web"
62+
jellyfin_additional_opts: str
4663
```
64+
**Optional:** Additional Jellyfin options as in [Main Configuration Options](https://jellyfin.org/docs/general/administration/configuration#main-configuration-options)
4765
66+
```yml
67+
jellyfin_service: bool
68+
```
69+
**Optional:** Run Jellyfin as a headless service.
4870
49-
Jellyfin Directories
5071
```yml
51-
jellyfin_cache_dir: "/var/cache/jellyfin"
52-
jellyfin_log_dir: "/var/log/jellyfin"
53-
jellyfin_config_dir: "/etc/jellyfin"
54-
jellyfin_data_dir: "/var/lib/jellyfin"
72+
jellyfin_nowebapp: bool
73+
```
74+
**Optional:** Run Jellyfin without the web app.
75+
76+
### Advanced
77+
78+
```yml
79+
jellyfin_complus_gcserver: int
5580
```
81+
**Optional:** Run Jellyfin with ASP.NET Server Garbage Collection (uses more RAM and less CPU than Workstation GC). 0=Workstation, 1=Server.
5682
83+
```yml
84+
jellyfin_malloc_trim_threshold: 131072
85+
```
86+
Disable glibc dynamic heap adjustment.
87+
88+
---
5789
## Installing
5890
5991
Install via Ansible Galaxy or clone the Repo
@@ -62,7 +94,7 @@ ansible-galaxy role install sleepy-nols.jellyfin
6294

6395
git clone git@github.com:sleepy-nols/ansible-jellyfin.git
6496
```
65-
97+
---
6698
## Example Playbook
6799

68100
```yml
@@ -71,9 +103,11 @@ git clone git@github.com:sleepy-nols/ansible-jellyfin.git
71103
- sleepy-nols.jellyfin
72104
```
73105
106+
---
74107
## Contributing
75108
76109
Contributions on are welcome, please write meaningfull commit messages :)
77110
111+
---
78112
## License
79113
GPLv3

defaults/main.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
---
2-
2+
jellyfin_name: "jellyfin"
3+
jellyfin_user: "{{ jellyfin_name }}"
34
jellyfin_skip_apt_key: false
45
jellyfin_skip_restart: false
6+
57
jellyfin_enable_fail2ban: false
68
jellyfin_fail2ban_ports:
79
- "80"
810
- "443"
11+
jellyfin_fail2ban_maxretry: 3
12+
jellyfin_fail2ban_bantime: 6000
13+
jellyfin_fail2ban_findtime: 600
914

10-
jellyfin_user: "jellyfin"
11-
12-
jellyfin_additional_opts: ""
13-
14-
# Paths
15-
jellyfin_restart_opt: "--restartpath=/usr/lib/jellyfin/restart.sh"
16-
jellyfin_ffmpeg_opt: "--ffmpeg=/usr/lib/jellyfin-ffmpeg/ffmpeg"
17-
jellyfin_web_opt: "--webdir=/usr/share/jellyfin/web"
18-
19-
# Directories
2015
jellyfin_cache_dir: "/var/cache/jellyfin"
2116
jellyfin_log_dir: "/var/log/jellyfin"
22-
jellyfin_config_dir: "/etc/jellyfin"
23-
jellyfin_data_dir: "/var/lib/jellyfin"
2417

25-
# optional
26-
# jellyfin_nowebapp_opt: "--nowebclient"
27-
# jellyfin_service_opt: "--service"
18+
jellyfin_web_bin: "/usr/share/jellyfin/web"
19+
jellyfin_restart_bin: "/usr/lib/jellyfin/restart.sh"
20+
jellyfin_ffmpeg_bin: "/usr/lib/jellyfin-ffmpeg/ffmpeg"
21+
22+
jellyfin_additional_opts: ""
23+
24+
jellyfin_malloc_trim_threshold: 131072

templates/config.jinja

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#
2-
# Ansible managed
3-
#
4-
5-
#
6-
# General options
2+
# {{ ansible_managed }}
73
#
84

95
# Program directories
@@ -13,42 +9,30 @@ JELLYFIN_LOG_DIR="{{ jellyfin_log_dir }}"
139
JELLYFIN_CACHE_DIR="{{ jellyfin_cache_dir }}"
1410

1511
# web client path, installed by the jellyfin-web package
16-
JELLYFIN_WEB_OPT="{{ jellyfin_web_opt }}"
12+
JELLYFIN_WEB_OPT="--webdir={{ jellyfin_web_bin }}"
1713

1814
# Restart script for in-app server control
19-
JELLYFIN_RESTART_OPT="{{ jellyfin_restart_opt }}"
15+
JELLYFIN_RESTART_OPT="--restartpath={{ jellyfin_restart_bin }}"
2016

2117
# ffmpeg binary paths, overriding the system values
22-
JELLYFIN_FFMPEG_OPT="{{ jellyfin_ffmpeg_opt }}"
18+
JELLYFIN_FFMPEG_OPT="--ffmpeg={{ jellyfin_ffmpeg_bin }}"
2319

2420
# Disable glibc dynamic heap adjustment
25-
MALLOC_TRIM_THRESHOLD_=131072
21+
MALLOC_TRIM_THRESHOLD_={{ jellyfin_malloc_trim_threshold | int }}
2622

2723
# [OPTIONAL] run Jellyfin as a headless service
28-
{% if jellyfin_service_opt is defined %}
29-
JELLYFIN_SERVICE_OPT="{{ jellyfin_service_opt }}"
24+
{% if jellyfin_service is defined %}
25+
JELLYFIN_SERVICE_OPT="{% if jellyfin_service | bool %}--service{% endif %}"
3026
{% endif %}
3127

3228
# [OPTIONAL] run Jellyfin without the web app
33-
{% if jellyfin_nowebapp_opt is defined %}
34-
JELLYFIN_NOWEBAPP_OPT="{{ jellyfin_nowebapp_opt }}"
29+
{% if jellyfin_nowebapp is defined %}
30+
JELLYFIN_NOWEBAPP_OPT="{% if jellyfin_nowebapp | bool %}--nowebclient{% endif %}"
3531
{% endif %}
3632

3733
# Space to add additional command line options to jellyfin (for help see ~$ jellyfin --help)
3834
JELLYFIN_ADDITIONAL_OPTS="{{ jellyfin_additional_opts }}"
3935

40-
# [OPTIONAL] run Jellyfin with ASP.NET Server Garbage Collection (uses more RAM and less CPU than Workstation GC)
41-
# 0 = Workstation
42-
# 1 = Server
43-
#COMPlus_gcServer=1
4436

45-
#
46-
# SysV init/Upstart options
47-
#
48-
# Note: These options are ignored by systemd; use /etc/systemd/system/jellyfin.d overrides instead.
49-
#
37+
COMPlus_gcServer={{ jellyfin_complus_gcserver | int }}
5038

51-
# Application username
52-
JELLYFIN_USER="{{ jellyfin_user }}"
53-
# Full application command
54-
JELLYFIN_ARGS="$JELLYFIN_WEB_OPT $JELLYFIN_RESTART_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLFIN_ADDITIONAL_OPTS"

templates/fail2ban_filter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Ansible managed
2+
# {{ ansible_managed }}
33
#
44

55
[Definition]

templates/fail2ban_jail

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Ansible managed
2+
# {{ ansible_managed }}
33
#
44

55
[jellyfin]
@@ -10,7 +10,7 @@ port = {% for p in jellyfin_fail2ban_ports %}{{ p }}{% if not loop.last %},{% en
1010

1111
protocol = tcp
1212
filter = jellyfin
13-
maxretry = {{ jellyfin_fail2ban_maxretry | default("3") }}
14-
bantime = {{ jellyfin_fail2ban_bantime | default("6000") }}
15-
findtime = {{ jellyfin_fail2ban_findtime | default("600") }}
13+
maxretry = {{ jellyfin_fail2ban_maxretry }}
14+
bantime = {{ jellyfin_fail2ban_bantime }}
15+
findtime = {{ jellyfin_fail2ban_findtime }}
1616
logpath = {{ jellyfin_log_dir }}/jellyfin*.log

templates/jellyfin.sources.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Ansible Managed
2+
# {{ ansible_managed }}
33
#
44

55
Types: deb

0 commit comments

Comments
 (0)