Robert Kaussow
4a6edebee8
All checks were successful
continuous-integration/drone/push Build is passing
80 lines
2.4 KiB
YAML
80 lines
2.4 KiB
YAML
---
|
|
- name: Prepare base folders
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: "{{ jellyfin_user }}"
|
|
group: "{{ jellyfin_user }}"
|
|
mode: 0750
|
|
loop:
|
|
- "{{ jellyfin_base_dir }}"
|
|
- "{{ jellyfin_base_dir }}/{{ jellyfin_version }}"
|
|
- "{{ jellyfin_conf_dir }}"
|
|
- "{{ jellyfin_data_dir }}"
|
|
- "{{ jellyfin_log_dir }}"
|
|
become: True
|
|
become_user: root
|
|
|
|
- block:
|
|
- name: Install portable binary
|
|
unarchive:
|
|
src: https://repo.jellyfin.org/releases/server/linux/jellyfin_{{ jellyfin_version }}.portable-linux-amd64.tar.gz
|
|
dest: "{{ jellyfin_base_dir }}/{{ jellyfin_version }}"
|
|
extra_opts:
|
|
- --strip-components=1
|
|
remote_src: yes
|
|
|
|
- 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
|
|
|
|
- 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 }}"
|
|
|
|
- block:
|
|
- name: Write current version to custom fact
|
|
template:
|
|
src: etc/ansible/facts.d/jellyfin.fact.j2
|
|
dest: /etc/ansible/facts.d/jellyfin.fact
|
|
when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=")
|
|
|
|
- name: Copy systemd unit file
|
|
template:
|
|
src: "etc/systemd/system/jellyfin.service.j2"
|
|
dest: "/etc/systemd/system/jellyfin.service"
|
|
# notify: __jellyfin_restart
|
|
|
|
- name: Copy logrotate config
|
|
template:
|
|
src: "etc/logrotate.d/config.j2"
|
|
dest: "/etc/logrotate.d/jellyfin"
|
|
loop: "{{ jellyfin_logrotate_config }}"
|
|
loop_control:
|
|
label: "{{ item.log }}"
|
|
when: jellyfin_logrotate_enabled
|
|
|
|
- name: Open ports in iptables
|
|
iptables_raw:
|
|
name: "{{ item.name }}"
|
|
rules: "{{ item.rules }}"
|
|
state: "{{ item.state }}"
|
|
weight: "{{ item.weight | default(omit) }}"
|
|
table: "{{ item.table | default(omit) }}"
|
|
loop: "{{ jellyfin_open_ports }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when: jellyfin_iptables_enabled
|
|
become: True
|
|
become_user: root
|