commit a72d95ec9316617cde974adeaa190f2e7693eb3d Author: Brian Lee Date: Sun Jul 23 21:41:50 2023 -0700 Initialize repo for Jellyfin role. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4baac1e --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +MIT No Attribution License + +Copyright (c) 2023 Brian Lee + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..2951e45 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Ansible Role: jellyfin + +Install Jellyfin media server using upstream packages from the Jellyfin repositories. + +## Requirements + +None. + +## Role Variables + +See the role [vars](vars/main.yml) + +## Example Playbook + +```yaml +- hosts: jellyfin + roles: + - role: bleetube.jellyfin + become: true +``` \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..6099501 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,2 @@ +--- +dependencies: [] \ No newline at end of file diff --git a/tasks/Debian.yml b/tasks/Debian.yml new file mode 100644 index 0000000..ee7f589 --- /dev/null +++ b/tasks/Debian.yml @@ -0,0 +1,26 @@ +--- +# https://www.jeffgeerling.com/blog/2022/aptkey-deprecated-debianubuntu-how-fix-ansible +- name: Add jellyfin apt repository key. + ansible.builtin.get_url: + url: "{{ jellyfin_repo_key_url }}" + dest: /usr/share/keyrings/jellyfin.asc + mode: '0644' + +- name: Ensure the repository is added with the relevant trusted GPG key + ansible.builtin.lineinfile: + path: /etc/apt/sources.list.d/jellyfin.list + regexp: 'repo.jellyfin.org' + line: "deb [arch=amd64 signed-by=/usr/share/keyrings/jellyfin.asc] https://repo.jellyfin.org/{{ ansible_facts.lsb.id | lower }} {{ ansible_distribution_release }} main" + create: true + register: jellyfin_repo + +- name: Update the apt repository cache + ansible.builtin.apt: + update_cache: yes + when: jellyfin_repo.changed + +- name: Install the jellyfin package + ansible.builtin.apt: + name: jellyfin + state: latest + diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..71dc09a --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,16 @@ +--- +- name: Install jellyfin (Debian) + import_tasks: Debian.yml + when: ansible_os_family == 'Debian' + +- name: Install jellyfin (non-Debian) + ansible.builtin.package: + name: jellyfin + state: present + when: ansible_os_family != 'Debian' + +- name: Ensure jellyfin is enabled on boot + ansible.builtin.service: + name: jellyfin + enabled: true + state: started diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..5ffefe7 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,2 @@ +--- +jellyfin_repo_key_url: "https://repo.jellyfin.org/{{ ansible_facts.lsb.id | lower }}/jellyfin_team.gpg.key" \ No newline at end of file