This commit is contained in:
parent
7cd44bbe53
commit
6927806972
5 changed files with 51 additions and 3 deletions
|
@ -2,4 +2,6 @@ music_audio_user: audio
|
||||||
music_audio_group: audio
|
music_audio_group: audio
|
||||||
music_librespot_user: librespot
|
music_librespot_user: librespot
|
||||||
|
|
||||||
|
music_pulse_server: /tmp/pipewire-pulse-socket
|
||||||
|
|
||||||
music_mqtt_mpd_volume: bitlair/music/space/volume
|
music_mqtt_mpd_volume: bitlair/music/space/volume
|
||||||
|
|
42
roles/music/tasks/base.yaml
Normal file
42
roles/music/tasks/base.yaml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
- name: Install pipewire
|
||||||
|
apt:
|
||||||
|
name:
|
||||||
|
- pipewire
|
||||||
|
- pipewire-jack
|
||||||
|
- pipewire-pulse
|
||||||
|
- pulseaudio-utils
|
||||||
|
- pulsemixer
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add audio group
|
||||||
|
group:
|
||||||
|
name: audio
|
||||||
|
system: true
|
||||||
|
|
||||||
|
- name: Set PULSE_SERVER env var for all shells
|
||||||
|
copy:
|
||||||
|
dest: /etc/profile.d/pulse-server.sh
|
||||||
|
content: |+
|
||||||
|
# Ansible managed
|
||||||
|
export PULSE_SERVER={{ music_pulse_server }}
|
||||||
|
|
||||||
|
- name: Create pipewire-pulse config dir
|
||||||
|
file:
|
||||||
|
path: /etc/pipewire/pipewire-pulse.conf.d/
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: Configure system socket
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/pipewire/pipewire-pulse.conf.d/system-socket.conf
|
||||||
|
content: |+
|
||||||
|
# Ansible managed
|
||||||
|
context.exec = [
|
||||||
|
{ path = "/bin/chgrp" args = "{{ music_audio_group }} {{ music_pulse_server }}" }
|
||||||
|
{ path = "/bin/chmod" args = "g+rwx,o-rwx {{ music_pulse_server }}" }
|
||||||
|
]
|
||||||
|
pulse.properties = {
|
||||||
|
server.address = [
|
||||||
|
"unix:{{ music_pulse_server }}"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,4 +1,9 @@
|
||||||
---
|
---
|
||||||
|
- name: Import base
|
||||||
|
ansible.builtin.import_tasks:
|
||||||
|
file: base.yaml
|
||||||
|
tags:
|
||||||
|
- music_base
|
||||||
|
|
||||||
- name: Import mpd
|
- name: Import mpd
|
||||||
ansible.builtin.import_tasks:
|
ansible.builtin.import_tasks:
|
||||||
|
|
|
@ -9,8 +9,7 @@ Type=simple
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=2s
|
RestartSec=2s
|
||||||
ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend pulseaudio --volume-ctrl linear
|
ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend pulseaudio --volume-ctrl linear
|
||||||
Environment="PULSE_SERVER=/tmp/pipewire-pulse-socket"
|
Environment="PULSE_SERVER={{ music_pulse_server }}"
|
||||||
Environment="XDG_RUNTIME_DIR=/run/user/0"
|
|
||||||
User={{ music_librespot_user }}
|
User={{ music_librespot_user }}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -36,5 +36,5 @@ decoder {
|
||||||
audio_output {
|
audio_output {
|
||||||
type "pulse"
|
type "pulse"
|
||||||
name "Pulse"
|
name "Pulse"
|
||||||
server "/tmp/pipewire-pulse-socket"
|
server "{{ music_pulse_server }}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue