This commit is contained in:
parent
43075d27fe
commit
7cd44bbe53
5 changed files with 115 additions and 6 deletions
|
@ -2,6 +2,12 @@
|
|||
- ansible.builtin.import_tasks:
|
||||
file: ../../common/handlers/main.yaml
|
||||
|
||||
- name: restart mpd
|
||||
ansible.builtin.systemd:
|
||||
name: mpd
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart trollibox
|
||||
ansible.builtin.systemd:
|
||||
name: trollibox
|
||||
|
|
|
@ -1,14 +1,32 @@
|
|||
---
|
||||
|
||||
- name: Install MPD
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- jackd
|
||||
- mpd
|
||||
- python3-mpd
|
||||
- python3-serial
|
||||
name: mpd
|
||||
state: present
|
||||
|
||||
- name: Add mpd user to the {{ music_audio_group }} group
|
||||
user:
|
||||
name: mpd
|
||||
groups:
|
||||
- "{{ music_audio_group }}"
|
||||
notify: restart mpd
|
||||
|
||||
- name: Install mpd file
|
||||
ansible.builtin.template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart mpd
|
||||
with_items:
|
||||
- src: mpd.conf
|
||||
dest: /etc/mpd.conf
|
||||
- src: mpd.service
|
||||
dest: /etc/systemd/system/mpd.service
|
||||
- src: mpd_state
|
||||
dest: /var/lib/mpd/state.default
|
||||
|
||||
- name: Install mpd-volume-to-mqtt script
|
||||
ansible.builtin.template:
|
||||
src: mpd-volume-to-mqtt.sh
|
||||
|
@ -34,6 +52,13 @@
|
|||
enabled: true
|
||||
daemon_reload: true
|
||||
|
||||
- name: Install skipbutton depedencies
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- python3-mpd
|
||||
- python3-serial
|
||||
state: present
|
||||
|
||||
- name: Clone skipbutton source
|
||||
ansible.builtin.git:
|
||||
repo: https://github.com/bitlair/skipbutton.git
|
||||
|
|
40
roles/music/templates/mpd.conf
Normal file
40
roles/music/templates/mpd.conf
Normal file
|
@ -0,0 +1,40 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
user "mpd"
|
||||
group "{{ music_audio_group }}"
|
||||
|
||||
bind_to_address "any"
|
||||
port "6600"
|
||||
max_connections "20"
|
||||
|
||||
zeroconf_enabled "yes"
|
||||
zeroconf_name "MPD @ %h"
|
||||
|
||||
music_directory "/srv/media/music"
|
||||
auto_update "yes"
|
||||
filesystem_charset "UTF-8"
|
||||
|
||||
playlist_directory "/var/lib/mpd/playlists"
|
||||
db_file "/var/lib/mpd/tag_cache"
|
||||
state_file "/var/lib/mpd/state"
|
||||
sticker_file "/var/lib/mpd/sticker.sql"
|
||||
|
||||
input {
|
||||
plugin "curl" # Required for web streams.
|
||||
}
|
||||
|
||||
decoder {
|
||||
plugin "hybrid_dsd"
|
||||
enabled "no"
|
||||
}
|
||||
|
||||
decoder {
|
||||
plugin "wildmidi"
|
||||
enabled "no"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "Pulse"
|
||||
server "/tmp/pipewire-pulse-socket"
|
||||
}
|
21
roles/music/templates/mpd.service
Normal file
21
roles/music/templates/mpd.service
Normal file
|
@ -0,0 +1,21 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Music Player Daemon
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/mkdir -p /run/mpd
|
||||
ExecStartPre=/bin/chown -R mpd:nogroup /run/mpd
|
||||
ExecStartPre=/bin/touch /var/log/mpd.log
|
||||
ExecStartPre=/bin/chown mpd:nogroup /var/log/mpd.log
|
||||
ExecStartPre=/usr/bin/cp /var/lib/mpd/state.default /var/lib/mpd/state
|
||||
ExecStart=/usr/bin/mpd --no-daemon /etc/mpd.conf
|
||||
# MDP will fork itself to the user defined in its config
|
||||
User=root
|
||||
LimitMEMLOCK=infinity
|
||||
LimitRTPRIO=99
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
17
roles/music/templates/mpd_state
Normal file
17
roles/music/templates/mpd_state
Normal file
|
@ -0,0 +1,17 @@
|
|||
sw_volume: 20
|
||||
audio_device_state:1:Pulse
|
||||
state: play
|
||||
current: 0
|
||||
time: 0
|
||||
random: 0
|
||||
repeat: 0
|
||||
single: 0
|
||||
consume: 0
|
||||
crossfade: 0
|
||||
mixrampdb: 0.000000
|
||||
mixrampdelay: -1.000000
|
||||
playlist_begin
|
||||
song_begin: http://ice4.somafm.com/groovesalad-256-mp3
|
||||
Name: SomaFM Groove Salad
|
||||
song_end
|
||||
playlist_end
|
Loading…
Add table
Add a link
Reference in a new issue