diff --git a/kodi.yaml b/kodi.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c8c05116195b9190c685e26583d0a3cdade1de84 --- /dev/null +++ b/kodi.yaml @@ -0,0 +1,7 @@ +--- +- hosts: + - kodi + roles: + - kodi + become: true + become_user: root diff --git a/roles/kodi/files/kodi.service b/roles/kodi/files/kodi.service new file mode 100644 index 0000000000000000000000000000000000000000..42630c7c47287d42cedbb55f1bbf83c1888d6260 --- /dev/null +++ b/roles/kodi/files/kodi.service @@ -0,0 +1,14 @@ +[Unit] +Description=Kodi Media Center +Requires=dbus.socket +After=network.target +After=sound.target + +[Service] +User=kodi +ExecStart=flatpak run --device=dri --filesystem=home --filesystem=/srv/library tv.kodi.Kodi --standalone --windowing=gbm +KillMode=control-group +Restart=always + +[Install] +WantedBy=multi-user.target graphical.target diff --git a/roles/kodi/tasks/main.yml b/roles/kodi/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..59e8cecce0a1f489d4339d7cdd5773035e7ebb84 --- /dev/null +++ b/roles/kodi/tasks/main.yml @@ -0,0 +1,53 @@ +--- +- name: APT install + apt: + name: + - avahi-daemon + - desktop-base + - flatpak + #- plymouth-themes + - pulseaudio + - udisks2 + - unison + - upower + +- name: Add Flatpak remotes + with_dict: + flathub: https://flathub.org/repo/flathub.flatpakrepo + flathub-beta: https://flathub.org/beta-repo/flathub-beta.flatpakrepo + community.general.flatpak_remote: + flatpakrepo_url: '{{ item.value }}' + method: system + name: '{{ item.key }}' + state: present + +- name: Install Flatpak + community.general.flatpak: + method: system + name: tv.kodi.Kodi + remote: flathub-beta + state: present + +- name: Create user + user: + create_home: true + home: /var/lib/kodi + id: 999 + name: kodi + password: '!' # pragma: allowlist secret + shell: /bin/false + state: present + system: true + +- name: Copy service + copy: + dest: /etc/systemd/system/kodi.service + mode: preserve + src: kodi.service + +- name: Enable service + service: + daemon-reload: true + enabled: true + name: kodi.service + state: started