xoxys.jellyfin/tasks/install.yml
Robert Kaussow 8f2299b314
Some checks failed
continuous-integration/drone/push Build is failing
ignore missing service during install stop task
2021-04-18 17:58:33 +02:00

88 lines
2.5 KiB
YAML

---
- name: Prepare base folders
file:
path: "{{ item }}"
state: directory
owner: "{{ jellyfin_user }}"
group: "{{ jellyfin_user }}"
mode: 0750
loop:
- "{{ jellyfin_base_dir }}"
- "{{ jellyfin_src_dir }}"
- "{{ jellyfin_conf_dir }}"
- "{{ jellyfin_data_dir }}"
- "{{ jellyfin_log_dir }}"
- "{{ jellyfin_cache_dir }}"
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 }}"
extra_opts:
- --strip-components=2
remote_src: yes
become: True
become_user: "{{ jellyfin_user }}"
when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=")
- name: Deploy global config files
template:
src: "opt/jellyfin/config/{{ item }}.j2"
dest: "{{ jellyfin_conf_dir }}/{{ item }}"
mode: 0600
loop:
- "logging.json"
notify: __jellyfin_restart
become: True
become_user: "{{ jellyfin_user }}"
- block:
- 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