music: Add Librespot
This commit is contained in:
parent
7356db2b8a
commit
2a54ec3ec6
4 changed files with 65 additions and 0 deletions
|
@ -15,3 +15,14 @@
|
||||||
name: trollibox
|
name: trollibox
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
|
- name: rebuild librespot
|
||||||
|
command: cargo build --release --features jackaudio-backend
|
||||||
|
args:
|
||||||
|
chdir: /opt/librespot
|
||||||
|
|
||||||
|
- name: restart librespot
|
||||||
|
systemd:
|
||||||
|
name: librespot
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: true
|
||||||
|
|
31
roles/music/tasks/librespot.yaml
Normal file
31
roles/music/tasks/librespot.yaml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
---
|
||||||
|
- name: Install dependencies
|
||||||
|
apt:
|
||||||
|
name: libjack-jackd2-dev
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Clone librespot source
|
||||||
|
git:
|
||||||
|
repo: https://github.com/librespot-org/librespot.git
|
||||||
|
version: dev
|
||||||
|
dest: /opt/librespot
|
||||||
|
accept_hostkey: yes
|
||||||
|
notify:
|
||||||
|
- rebuild librespot
|
||||||
|
- restart librespot
|
||||||
|
|
||||||
|
- name: Install service file
|
||||||
|
template:
|
||||||
|
src: librespot.service
|
||||||
|
dest: /etc/systemd/system/librespot.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: restart librespot
|
||||||
|
|
||||||
|
- name: Enable Librespot
|
||||||
|
systemd:
|
||||||
|
name: librespot
|
||||||
|
state: started
|
||||||
|
enabled: true
|
||||||
|
daemon_reload: true
|
|
@ -4,3 +4,6 @@
|
||||||
|
|
||||||
- tags: music_trollibox
|
- tags: music_trollibox
|
||||||
include_tasks: trollibox.yaml
|
include_tasks: trollibox.yaml
|
||||||
|
|
||||||
|
- tags: music_librespot
|
||||||
|
include_tasks: librespot.yaml
|
||||||
|
|
20
roles/music/templates/librespot.service
Normal file
20
roles/music/templates/librespot.service
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#
|
||||||
|
# Managed by Ansible
|
||||||
|
#
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Spotify through Librespot
|
||||||
|
After=network.target
|
||||||
|
Requires=jackd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2s
|
||||||
|
ExecStart=/opt/librespot/target/release/librespot --name Trollibox --backend jackaudio
|
||||||
|
User={{ music_audio_user }}
|
||||||
|
Group={{ music_audio_user }}
|
||||||
|
AmbientCapabilities=CAP_IPC_LOCK,CAP_SYS_NICE
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Add table
Reference in a new issue