Add Jellyfin media stack (LXC 106, NVIDIA GTX 1060)
- New Ansible role: jellyfin — Docker + nvidia-container-toolkit setup, full *arr stack compose file (Jellyfin, qBittorrent, Radarr, Sonarr, Prowlarr, FlareSolverr, Jellyseerr), systemd service for auto-start - New playbook: jellyfin.yml targeting media_servers group - Inventory: add media LXC (10.10.1.50) to media_servers group - Traefik: add internal .homelab routes for all 6 media services - Pi-hole: add DNS records for all 6 media services → Traefik - network-interfaces: DNAT port 6881 TCP+UDP → 10.10.1.50 for BitTorrent - homelab-requirements.md: document full Jellyfin stack requirements including NVIDIA GTX 1060 passthrough approach and driver notes - jellyfin-tools: original reference compose file from upstream Infrastructure created on Proxmox: - LXC 106 (media, Debian 12, privileged, nesting=1, 10.10.1.50/vmbr1) - ZFS dataset hdd/media mounted at /media in LXC - NVIDIA device passthrough entries in /etc/pve/lxc/106.conf Note: NVIDIA driver 580.159.03 (.run) installed on Proxmox host — not managed by apt (Debian only has 550.x which doesn't support kernel 7.x or GTX 1060 Pascal as of this driver version). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
---
|
||||
# --- System setup ---
|
||||
|
||||
- name: Set timezone
|
||||
community.general.timezone:
|
||||
name: "{{ jellyfin_timezone }}"
|
||||
|
||||
- name: Grant adyrem passwordless sudo
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sudoers.d/adyrem
|
||||
content: "adyrem ALL=(ALL:ALL) NOPASSWD: ALL\n"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0440"
|
||||
validate: visudo -cf %s
|
||||
|
||||
- name: Install base packages
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- curl
|
||||
- ca-certificates
|
||||
- gnupg
|
||||
- apt-transport-https
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
# --- Docker ---
|
||||
|
||||
- name: Add Docker GPG key
|
||||
ansible.builtin.get_url:
|
||||
url: https://download.docker.com/linux/debian/gpg
|
||||
dest: /usr/share/keyrings/docker.asc
|
||||
mode: "0644"
|
||||
|
||||
- name: Add Docker apt repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: >-
|
||||
deb [arch=amd64 signed-by=/usr/share/keyrings/docker.asc]
|
||||
https://download.docker.com/linux/debian bookworm stable
|
||||
filename: docker
|
||||
state: present
|
||||
|
||||
- name: Install Docker and compose plugin
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-compose-plugin
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Enable and start Docker
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
enabled: true
|
||||
state: started
|
||||
|
||||
# --- NVIDIA container toolkit ---
|
||||
|
||||
- name: Add NVIDIA container toolkit GPG key
|
||||
ansible.builtin.get_url:
|
||||
url: https://nvidia.github.io/libnvidia-container/gpgkey
|
||||
dest: /usr/share/keyrings/nvidia-container-toolkit.asc
|
||||
mode: "0644"
|
||||
|
||||
- name: Add NVIDIA container toolkit apt repository
|
||||
ansible.builtin.get_url:
|
||||
url: https://nvidia.github.io/libnvidia-container/stable/deb/amd64/Packages
|
||||
dest: /tmp/nvidia-ct-packages
|
||||
mode: "0644"
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
|
||||
- name: Write nvidia-container-toolkit sources list
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
||||
content: |
|
||||
deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit.asc] https://nvidia.github.io/libnvidia-container/stable/deb/amd64 /
|
||||
mode: "0644"
|
||||
|
||||
- name: Install nvidia-container-toolkit
|
||||
ansible.builtin.apt:
|
||||
name: nvidia-container-toolkit
|
||||
state: present
|
||||
update_cache: true
|
||||
|
||||
- name: Configure Docker to use NVIDIA runtime
|
||||
ansible.builtin.command:
|
||||
cmd: nvidia-ctk runtime configure --runtime=docker
|
||||
changed_when: false
|
||||
|
||||
- name: Restart Docker to apply NVIDIA runtime
|
||||
ansible.builtin.systemd:
|
||||
name: docker
|
||||
state: restarted
|
||||
|
||||
# --- NVIDIA userspace libraries ---
|
||||
# The LXC has /dev/nvidia* bind-mounted from the host.
|
||||
# The host's NVIDIA driver version must match what we install here.
|
||||
|
||||
- name: Check if NVIDIA userspace libraries are installed
|
||||
ansible.builtin.stat:
|
||||
path: /usr/lib/x86_64-linux-gnu/libcuda.so.{{ nvidia_driver_version }}
|
||||
register: _nvidia_libs
|
||||
|
||||
- name: Copy NVIDIA installer from Proxmox host to LXC
|
||||
ansible.builtin.copy:
|
||||
src: /tmp/nvidia-580.run
|
||||
dest: /tmp/nvidia.run
|
||||
mode: "0755"
|
||||
when: not _nvidia_libs.stat.exists
|
||||
|
||||
- name: Install NVIDIA userspace libraries (no kernel module)
|
||||
ansible.builtin.command:
|
||||
cmd: /tmp/nvidia.run --silent --no-kernel-module --no-drm
|
||||
creates: /usr/lib/x86_64-linux-gnu/libcuda.so.{{ nvidia_driver_version }}
|
||||
when: not _nvidia_libs.stat.exists
|
||||
|
||||
# --- Config directories and compose file ---
|
||||
|
||||
- name: Create container config directories
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
loop: "{{ jellyfin_config_dirs }}"
|
||||
|
||||
- name: Create stack directory
|
||||
ansible.builtin.file:
|
||||
path: /opt/jellyfin
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Deploy docker-compose.yml
|
||||
ansible.builtin.template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: /opt/jellyfin/docker-compose.yml
|
||||
mode: "0644"
|
||||
notify: Restart jellyfin stack
|
||||
|
||||
- name: Deploy systemd service
|
||||
ansible.builtin.template:
|
||||
src: jellyfin-stack.service.j2
|
||||
dest: /etc/systemd/system/jellyfin-stack.service
|
||||
mode: "0644"
|
||||
notify: Restart jellyfin stack
|
||||
|
||||
- name: Enable and start jellyfin stack service
|
||||
ansible.builtin.systemd:
|
||||
name: jellyfin-stack
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
Reference in New Issue
Block a user