Skip to content

Instantly share code, notes, and snippets.

@leafonthewind
Last active May 22, 2024 15:21
Show Gist options
  • Save leafonthewind/5442f1981a6a0a03e90e98c668d46adc to your computer and use it in GitHub Desktop.
Save leafonthewind/5442f1981a6a0a03e90e98c668d46adc to your computer and use it in GitHub Desktop.
Jellyfin Ansible Playbook
# Template jellyfin/templates/jellyfin.sources.j2
Types: deb
URIs: https://repo.jellyfin.org/{{ VERSION_OS }}
Suites: {{ VERSION_CODENAME }}
Components: main
Architectures: {{ DPKG_ARCHITECTURE }}
Signed-By: /etc/apt/keyrings/jellyfin.gpg
resource "proxmox_lxc" "jellyfin" {
target_node = "pve"
hostname = "jellyfin"
ostemplate = "local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst"
unprivileged = true
ssh_public_keys = <<-EOT
XXX
EOT
rootfs {
storage = "XXX"
size = "100G"
}
cores = 4
memory = 8192
swap = 2048
onboot = true
network {
name = "eth0"
bridge = "vmbr0"
ip = "192.168.1.XXX/24"
gw = "192.168.1.1"
hwaddr = "XXX"
ip6 = "dhcp"
}
}
# Jellyfin role, jellyfin/tasks/main.yaml
- name: Install package dependencies
ansible.builtin.apt:
pkg:
- ca-certificates
- curl
- gnupg
- software-properties-common # needed for `add-apt-repository` command
state: present
- name: Add Universe repository
ansible.builtin.command: add-apt-repository --yes universe
changed_when: true
- name: Create keyrings folder
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: '755'
- name: Store gpg key for Jellyfin
ansible.builtin.apt_key:
url: https://repo.jellyfin.org/jellyfin_team.gpg.key
keyring: /etc/apt/keyrings/jellyfin.gpg
- name: Add Jellyfin repo
vars:
VERSION_OS: "{{ ansible_distribution | lower }}"
VERSION_CODENAME: "{{ ansible_distribution_release }}"
DPKG_ARCHITECTURE: "amd64"
ansible.builtin.template:
src: jellyfin.sources.j2
dest: /etc/apt/sources.list.d/jellyfin.sources
mode: '644'
- name: Install Jellyfin from repo
ansible.builtin.apt:
name:
- jellyfin
update_cache: true
state: present
- name: Enable jellyfin service
ansible.builtin.systemd:
name: jellyfin.service
state: started
enabled: true
- name: Allow Jellyfin port
community.general.ufw:
port: "{{ jellyfin_default_port }}"
rule: allow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment