rework portable installation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Robert Kaussow 2021-04-18 17:48:02 +02:00
parent 8ce8efcde8
commit ec4f5cc447
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
9 changed files with 81 additions and 51 deletions

View File

@ -1,11 +1,12 @@
---
jellyfin_version: 10.6.0
jellyfin_version: 10.7.2
jellyfin_user: jellyfin
jellyfin_user_home: "/home/{{ jellyfin_user }}"
jellyfin_group: "{{ jellyfin_user }}"
jellyfin_extra_groups: []
jellyfin_base_dir: "/opt/jellyfin"
jellyfin_src_dir: "{{ jellyfin_base_dir }}/src"
jellyfin_conf_dir: "{{ jellyfin_base_dir }}/config"
jellyfin_data_dir: "{{ jellyfin_base_dir }}/data"
jellyfin_log_dir: "{{ jellyfin_base_dir }}/log"
@ -25,12 +26,3 @@ jellyfin_selinux_fcontext:
setype: var_log_t
jellyfin_selinux_restorecon:
- "-ir {{ jellyfin_log_dir }}"
# @var jellyfin_http_bind_port:description: >
# DONT change it! Changing the bind ports is currently not supported.
# @end
jellyfin_http_bind_port: 8096
# @var jellyfin_https_bind_port:description: >
# DONT change it! Changing the bind ports is currently not supported.
# @end
jellyfin_https_bind_port: 8920

View File

@ -4,6 +4,8 @@
vars:
jellyfin_packages_extra:
- epel-release
- https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
- https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
roles:
- role: xoxys.jellyfin

View File

@ -8,7 +8,7 @@
mode: 0750
loop:
- "{{ jellyfin_base_dir }}"
- "{{ jellyfin_base_dir }}/{{ jellyfin_version }}"
- "{{ jellyfin_src_dir }}"
- "{{ jellyfin_conf_dir }}"
- "{{ jellyfin_data_dir }}"
- "{{ jellyfin_log_dir }}"
@ -17,20 +17,29 @@
become_user: root
- block:
- name: Install portable binary
- name: Ensure service is stopped before upgrade
systemd:
state: stopped
daemon_reload: yes
enabled: yes
name: jellyfin
- name: Delete current version
file:
path: "{{ jellyfin_src_dir }}"
state: absent
become: True
become_user: root
when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=")
- block:
- name: Install Jellyfin server
unarchive:
src: https://repo.jellyfin.org/releases/server/portable/versions/stable/combined/{{ jellyfin_version }}/jellyfin_{{ jellyfin_version }}.tar.gz
dest: "{{ jellyfin_base_dir }}/{{ jellyfin_version }}"
dest: "{{ jellyfin_src_dir }}"
extra_opts:
- --strip-components=1
- --strip-components=2
remote_src: yes
- name: Link 'v{{ jellyfin_version }}' to latest
file:
src: "{{ jellyfin_base_dir }}/{{ jellyfin_version }}/jellyfin"
dest: "{{ jellyfin_base_dir }}/jellyfin-latest"
state: link
notify: __jellyfin_restart
become: True
become_user: "{{ jellyfin_user }}"
when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=")
@ -47,17 +56,31 @@
become_user: "{{ jellyfin_user }}"
- block:
- name: Write current version to custom fact
- name: Write Jellyfin version to custom fact
template:
src: etc/ansible/facts.d/jellyfin.fact.j2
dest: /etc/ansible/facts.d/jellyfin.fact
mode: 0644
- name: Copy sysconfig file
template:
src: "etc/sysconfig/jellyfin.j2"
dest: "{{ __jellyfin_sysconfig }}"
mode: 0600
notify: __jellyfin_restart
- name: Copy systemd unit file
template:
src: "etc/systemd/system/jellyfin.service.j2"
dest: "/etc/systemd/system/jellyfin.service"
mode: 0644
notify: __jellyfin_restart
- name: Ensure jellyfin service is up and running
systemd:
state: started
daemon_reload: yes
enabled: yes
name: jellyfin
become: True
become_user: root

View File

@ -3,4 +3,3 @@
- include_tasks: install.yml
- include_tasks: selinux.yml
when: ansible_selinux.status == "enabled"
- include_tasks: post_tasks.yml

View File

@ -1,9 +0,0 @@
---
- name: Ensure jellyfin service is up and running
systemd:
state: started
daemon_reload: yes
enabled: yes
name: jellyfin
become: True
become_user: root

View File

@ -0,0 +1,6 @@
#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
JELLYFIN_DATA_DIR={{ jellyfin_data_dir }}
JELLYFIN_CONFIG_DIR={{ jellyfin_conf_dir }}
JELLYFIN_LOG_DIR={{ jellyfin_log_dir }}
JELLYFIN_CACHE_DIR={{ jellyfin_cache_dir }}

View File

@ -2,20 +2,28 @@
{{ ansible_managed | comment }}
[Unit]
Description=Jellyfin Media Server
After=network.target
Wants=network-online.target
After=network-online.target
After=syslog.target
[Service]
Type=simple
Environment=JELLYFIN_DATA_DIR={{ jellyfin_data_dir }}
Environment=JELLYFIN_CONFIG_DIR={{ jellyfin_conf_dir }}
Environment=JELLYFIN_LOG_DIR={{ jellyfin_log_dir }}
Environment=JELLYFIN_CACHE_DIR={{ jellyfin_cache_dir }}
Restart=on-failure
TimeoutSec=15
WorkingDirectory={{ jellyfin_src_dir }}
User={{ jellyfin_user }}
Group={{ jellyfin_group }}
WorkingDirectory={{ jellyfin_base_dir }}
ExecStart={{ jellyfin_base_dir }}/jellyfin-latest --service --noautorunwebapp
PermissionsStartOnly=true
EnvironmentFile={{ __jellyfin_sysconfig }}
ExecStart={{ jellyfin_src_dir }}/jellyfin --service
Restart=on-failure
TimeoutSec=15
# Avoid noisy crashloops
StartLimitInterval=60
StartLimitBurst=5
[Install]
WantedBy=multi-user.target

View File

@ -1,11 +1,17 @@
{
"Serilog": {
"MinimumLevel": "Information",
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] {Message:lj}{NewLine}{Exception}",
"outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}",
"restrictedToMinimumLevel": "{{ jellyfin_log_level_console }}"
}
},
@ -18,12 +24,17 @@
"Args": {
"path": "{{ jellyfin_log_dir }}/jellyfin.log",
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] {Message}{NewLine}{Exception}",
"restrictedToMinimumLevel": "{{ jellyfin_log_level_file }}"
"restrictedToMinimumLevel": "{{ jellyfin_log_level_file }}",
"rollingInterval": "Day",
"retainedFileCountLimit": 3,
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 100000000,
}
}
]
}
}
]
],
"Enrich": [ "FromLogContext", "WithThreadId" ]
}
}

View File

@ -1,8 +1,6 @@
---
__jellyfin_packages:
- lttng-ust
- libcurl
- openssl-libs
- krb5-libs
- libicu
- zlib
- aspnetcore-runtime-5.0
- ffmpeg
__jellyfin_sysconfig: /etc/sysconfig/minio