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
Branches
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@
- hosts:
- kodi
roles:
- debian_server
- kodi
become: true
become_user: root
---
- name: Rebuild initramfs
command:
cmd: update-initramfs -u
- name: Update GRUB
command:
cmd: update-grub
......@@ -5,6 +5,15 @@
- ansible_distribution == "Debian"
- 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
loop:
- deb
......
[Unit]
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.
After=srv-library.mount
......@@ -12,27 +12,17 @@ After=dbus.socket
Conflicts=getty@%i.service
Before=graphical.target
# On systems without virtual consoles, don't start
ConditionPathExists=/dev/tty0
[Service]
User=kodi
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
Restart=on-abort
Restart=always
RestartSec=5
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.
StandardOutput=tty
StandardInput=tty
StandardError=journal
# Log this user with utmp, letting it show up with commands 'w' and 'who'.
......@@ -41,4 +31,4 @@ UtmpMode=user
[Install]
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
command:
cmd: update-initramfs -u
- name: Restart Xorg
service:
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
apt:
cache_valid_time: 3600
install_recommends: false
name:
- alsa-utils
- avahi-daemon
- desktop-base
- flatpak
# - plymouth-themes
- plymouth-label
- plymouth-themes
- firmware-linux
- udisks2
- unison
- upower
- xorg
state: present
update_cache: true
- name: Configure boot splash
copy:
......@@ -23,6 +29,31 @@
notify:
- 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
with_dict:
flathub: https://flathub.org/repo/flathub.flatpakrepo
......@@ -43,6 +74,12 @@
- name: Create user
user:
create_home: true
groups:
- audio
- cdrom
- input
- plugdev
- video
home: /var/lib/kodi
name: kodi
password: '!' # pragma: allowlist secret
......@@ -50,16 +87,36 @@
state: present
system: true
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:
dest: /etc/systemd/system/
mode: preserve
src: kodi@.service
src: '{{ item }}'
notify:
- Restart Xorg
- Restart Kodi
- name: Enable service
- name: Enable services
with_items: *services
service:
daemon-reload: true
enabled: true
name: kodi@tty7.service
name: '{{ item }}'
state: started
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment