add player setup

This commit is contained in:
Tomáš Mládek 2024-09-19 14:33:04 +02:00
parent f2ee180967
commit 097dcfefc4
2 changed files with 63 additions and 0 deletions

12
parsifal-player.service Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=Parsifal Player
After=lightdm.service
[Service]
ExecStartPre=/bin/sh -c 'for i in {1..10}; do xset q && break || sleep 2; done'
ExecStart=/usr/bin/mpv --fs --no-osc --loop-file=inf %h/main.mov
Restart=always
Environment=DISPLAY=:0
[Install]
WantedBy=graphical.target

51
setup-player.yml Normal file
View file

@ -0,0 +1,51 @@
---
- hosts: players
become: yes
tasks:
- name: Install mpv, unclutter
apt:
name: "{{ item }}"
state: present
update_cache: yes
loop:
- mpv
- unclutter
- name: Ensure systemd user directory exists
file:
path: "/home/{{ ansible_user }}/.config/systemd/user"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0755"
- name: Copy all service files
copy:
src: "{{ item }}"
dest: "/home/{{ ansible_user }}/.config/systemd/user/{{ item }}"
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: "0644"
loop:
- parsifal.service
- unclutter.service
- name: Reload systemd user service
become: yes
become_user: "{{ ansible_user }}"
systemd:
daemon_reload: yes
scope: user
- name: Enable all services
become: yes
become_user: "{{ ansible_user }}"
systemd:
name: "{{ item }}"
enabled: yes
state: started
scope: user
loop:
- parsifal-player
- unclutter