Skip to content
Snippets Groups Projects
Commit a2b7d470 authored by nimrod's avatar nimrod
Browse files

Updates to the Kodi role and a little refactoring.

- Using the GBM backend for Kodi failed (maybe it's because I'm using
Flatpak, maybe not). Weston and Wayland failed (maybe the Weston version
in Buster is too old). Go back to good old Xorg.
- Configure Plymouth boot spalsh.
- Refactor GRUB and initramfs to the common debian_server role.
- Disable cgroup2 (unified hierarchy) because Docker in Buster doesn't
support it (Bullseye does) and with buster-backports it's now enabled by
default.
parent a7d19797
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
- hosts: - hosts:
- kodi - kodi
roles: roles:
- debian_server
- kodi - kodi
become: true become: true
become_user: root become_user: root
---
- name: Rebuild initramfs
command:
cmd: update-initramfs -u
- name: Update GRUB
command:
cmd: update-grub
...@@ -5,6 +5,15 @@ ...@@ -5,6 +5,15 @@
- ansible_distribution == "Debian" - ansible_distribution == "Debian"
- ansible_distribution_major_version|int >= 10 - ansible_distribution_major_version|int >= 10
- name: Disable cgroup2 for Docker
lineinfile:
backup: true
line: |-
GRUB_CMDLINE_LINUX_DEFAULT="quiet systemd.unified_cgroup_hierarchy=0"
path: /etc/default/grub
notify:
- Update GRUB
- name: Enable the backports repo - name: Enable the backports repo
loop: loop:
- deb - deb
......
[Unit] [Unit]
Description=Kodi Media Center on %i Description=Kodi Media Center on %i
After=systemd-user-sessions.service sound.target network-online.target After=systemd-user-sessions.service sound.target network-online.target xorg.service
# Require the library to be mounted. # Require the library to be mounted.
After=srv-library.mount After=srv-library.mount
...@@ -12,27 +12,17 @@ After=dbus.socket ...@@ -12,27 +12,17 @@ After=dbus.socket
Conflicts=getty@%i.service Conflicts=getty@%i.service
Before=graphical.target Before=graphical.target
# On systems without virtual consoles, don't start
ConditionPathExists=/dev/tty0
[Service] [Service]
User=kodi User=kodi
PAMName=login PAMName=login
ExecStart=flatpak run --device=all --filesystem=/srv/library tv.kodi.Kodi --standalone --windowing=gbm -fs Environment="DISPLAY=:0"
ExecStart=flatpak run --device=all --filesystem=/etc/group --filesystem=/srv/library tv.kodi.Kodi --standalone --windowing=x11 -fs
Type=simple Type=simple
Restart=on-abort Restart=always
RestartSec=5 RestartSec=5
KillMode=control-group KillMode=control-group
# A virtual terminal is needed.
TTYPath=/dev/%i
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
# Fail to start if not controlling the tty. # Fail to start if not controlling the tty.
StandardOutput=tty
StandardInput=tty
StandardError=journal StandardError=journal
# Log this user with utmp, letting it show up with commands 'w' and 'who'. # Log this user with utmp, letting it show up with commands 'w' and 'who'.
...@@ -41,4 +31,4 @@ UtmpMode=user ...@@ -41,4 +31,4 @@ UtmpMode=user
[Install] [Install]
WantedBy=graphical.target WantedBy=graphical.target
DefaultInstance=tty7 DefaultInstance=tty1
[Unit]
Description=X Windows display server
After=systemd-user-sessions.service
# D-Bus is necessary for contacting logind. Logind is required.
Wants=dbus.socket
After=dbus.socket
Conflicts=getty@tty7.service
Before=graphical.target
# On systems without virtual consoles, don't start
ConditionPathExists=/dev/tty7
[Service]
User=kodi
SupplementaryGroups=tty
PAMName=login
ExecStart=startx
Type=simple
Restart=on-abort
RestartSec=5
KillMode=control-group
# A virtual terminal is needed.
TTYPath=/dev/tty7
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
# Fail to start if not controlling the tty.
StandardOutput=tty
StandardInput=tty
StandardError=journal
# Log this user with utmp, letting it show up with commands 'w' and 'who'.
UtmpIdentifier=tty7
UtmpMode=user
[Install]
WantedBy=graphical.target
--- ---
- name: Rebuild initramfs - name: Restart Xorg
command: service:
cmd: update-initramfs -u name: xorg.service
state: restarted
- name: Restart Kodi
service:
name: kodi.service
state: restarted
---
galaxy_info:
author: Nimrod Adar
company: Shore
description: Standalone Kodi
license: MIT
min_ansible_version: 2.10
platforms:
- name: Debian
versions:
- Buster
dependencies:
- role: debian_server
--- ---
- name: APT install - name: APT install
apt: apt:
cache_valid_time: 3600
install_recommends: false
name: name:
- alsa-utils - alsa-utils
- avahi-daemon - avahi-daemon
- desktop-base - desktop-base
- flatpak - flatpak
# - plymouth-themes - plymouth-label
- plymouth-themes
- firmware-linux - firmware-linux
- udisks2 - udisks2
- unison - unison
- upower - upower
- xorg
state: present
update_cache: true
- name: Configure boot splash - name: Configure boot splash
copy: copy:
...@@ -23,6 +29,31 @@ ...@@ -23,6 +29,31 @@
notify: notify:
- Rebuild initramfs - Rebuild initramfs
- name: Enable boot splash
lineinfile:
backup: true
# yamllint disable-line rule:line-length
line: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash systemd.unified_cgroup_hierarchy=0"
path: /etc/default/grub
notify:
- Update GRUB
- name: Create library mountpoint
file:
mode: 0o0755
path: /srv/library
state: directory
- name: Mount library
ansible.posix.mount:
backup: true
fstype: auto
opts: defaults
path: /srv/library
src: UUID=cbc01549-0acf-472f-8964-2701e7fb4927
state: mounted
notify: Restart Kodi
- name: Add Flatpak remotes - name: Add Flatpak remotes
with_dict: with_dict:
flathub: https://flathub.org/repo/flathub.flatpakrepo flathub: https://flathub.org/repo/flathub.flatpakrepo
...@@ -43,6 +74,12 @@ ...@@ -43,6 +74,12 @@
- name: Create user - name: Create user
user: user:
create_home: true create_home: true
groups:
- audio
- cdrom
- input
- plugdev
- video
home: /var/lib/kodi home: /var/lib/kodi
name: kodi name: kodi
password: '!' # pragma: allowlist secret password: '!' # pragma: allowlist secret
...@@ -50,16 +87,36 @@ ...@@ -50,16 +87,36 @@
state: present state: present
system: true system: true
uid: 900 uid: 900
notify:
- Restart Xorg
- Restart Kodi
- name: Copy service - name: Configure rootless Xorg
copy:
backup: true
content: |
allowed_users=anybody
dest: /etc/X11/Xwrapper.config
mode: 0o0644
notify:
- Restart Xorg
- name: Copy services
with_items: &services
- xorg.service
- kodi.service
copy: copy:
dest: /etc/systemd/system/ dest: /etc/systemd/system/
mode: preserve mode: preserve
src: kodi@.service src: '{{ item }}'
notify:
- Restart Xorg
- Restart Kodi
- name: Enable service - name: Enable services
with_items: *services
service: service:
daemon-reload: true daemon-reload: true
enabled: true enabled: true
name: kodi@tty7.service name: '{{ item }}'
state: started state: started
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment