From 905d9899cce2b4c3446414d170dca2b6d6d845fe Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 18 Apr 2021 18:42:56 +0200 Subject: [PATCH] switch back to version symlink (#1) Co-authored-by: Robert Kaussow Reviewed-on: https://gitea.rknet.org/ansible/xoxys.jellyfin/pulls/1 Co-authored-by: Robert Kaussow Co-committed-by: Robert Kaussow --- tasks/install.yml | 33 ++++++++----------- .../etc/systemd/system/jellyfin.service.j2 | 2 +- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/tasks/install.yml b/tasks/install.yml index 3d5db5a..5926428 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -8,7 +8,7 @@ mode: 0750 loop: - "{{ jellyfin_base_dir }}" - - "{{ jellyfin_src_dir }}" + - "{{ jellyfin_src_dir }}/{{ jellyfin_version }}" - "{{ jellyfin_conf_dir }}" - "{{ jellyfin_data_dir }}" - "{{ jellyfin_log_dir }}" @@ -16,31 +16,26 @@ become: True become_user: root -- block: - - name: Ensure service is stopped before upgrade - systemd: - state: stopped - daemon_reload: yes - enabled: yes - name: jellyfin - failed_when: "unused_disable is failed and ('find' not in unused_disable.msg and 'found' not in unused_disable.msg)" - - - 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_src_dir }}" + dest: "{{ jellyfin_src_dir }}/{{ jellyfin_version }}" extra_opts: - --strip-components=2 remote_src: yes + + - name: Link 'v{{ jellyfin_version }}' to latest + file: + src: "{{ jellyfin_src_dir }}/{{ jellyfin_version }}/jellyfin" + dest: "{{ jellyfin_base_dir }}/jellyfin-latest" + state: link + notify: __jellyfin_restart + + - name: Remove old version + file: + path: "{{ jellyfin_src_dir }}/{{ jellyfin_current_version }}" + state: absent become: True become_user: "{{ jellyfin_user }}" when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=") diff --git a/templates/etc/systemd/system/jellyfin.service.j2 b/templates/etc/systemd/system/jellyfin.service.j2 index 4b5c0f7..c0e1f41 100644 --- a/templates/etc/systemd/system/jellyfin.service.j2 +++ b/templates/etc/systemd/system/jellyfin.service.j2 @@ -17,7 +17,7 @@ Group={{ jellyfin_group }} PermissionsStartOnly=true EnvironmentFile={{ __jellyfin_sysconfig }} -ExecStart={{ jellyfin_src_dir }}/jellyfin --service +ExecStart={{ jellyfin_base_dir }}/jellyfin-latest --service Restart=on-failure TimeoutSec=15