Compare commits
4 commits
1c9a0b37d3
...
2a54ec3ec6
Author | SHA1 | Date | |
---|---|---|---|
2a54ec3ec6 | |||
7356db2b8a | |||
f8dd32b234 | |||
f24e8b6436 |
9 changed files with 147 additions and 0 deletions
3
hosts
3
hosts
|
@ -3,3 +3,6 @@ bank-pi.bitlair.nl
|
|||
|
||||
[mqtt_internal]
|
||||
mqtt.bitlair.nl
|
||||
|
||||
[music]
|
||||
music.bitlair.nl
|
||||
|
|
1
roles/music/defaults/main.yaml
Normal file
1
roles/music/defaults/main.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
music_audio_user: audio
|
28
roles/music/handlers/main.yaml
Normal file
28
roles/music/handlers/main.yaml
Normal file
|
@ -0,0 +1,28 @@
|
|||
---
|
||||
- name: reload nginx
|
||||
systemd:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
|
||||
- name: rebuild trollibox
|
||||
command: ./build.sh
|
||||
args:
|
||||
chdir: /opt/trollibox
|
||||
environment: { RELEASE: 1 }
|
||||
|
||||
- name: restart trollibox
|
||||
systemd:
|
||||
name: trollibox
|
||||
state: restarted
|
||||
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
|
9
roles/music/tasks/main.yaml
Normal file
9
roles/music/tasks/main.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
- tags: music_mpd
|
||||
include_tasks: mpd.yaml
|
||||
|
||||
- tags: music_trollibox
|
||||
include_tasks: trollibox.yaml
|
||||
|
||||
- tags: music_librespot
|
||||
include_tasks: librespot.yaml
|
7
roles/music/tasks/mpd.yaml
Normal file
7
roles/music/tasks/mpd.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Install MPD
|
||||
apt:
|
||||
name:
|
||||
- jackd
|
||||
- mpd
|
||||
state: present
|
29
roles/music/tasks/trollibox.yaml
Normal file
29
roles/music/tasks/trollibox.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
- name: Clone trollibox source
|
||||
git:
|
||||
repo: https://github.com/polyfloyd/trollibox.git
|
||||
version: master
|
||||
dest: /opt/trollibox
|
||||
accept_hostkey: yes
|
||||
notify:
|
||||
- rebuild trollibox
|
||||
- restart trollibox
|
||||
|
||||
- name: Initial build
|
||||
meta: flush_handlers
|
||||
|
||||
- name: Install service file
|
||||
template:
|
||||
src: trollibox.service
|
||||
dest: /etc/systemd/system/trollibox.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart trollibox
|
||||
|
||||
- name: Enable Trollibox
|
||||
systemd:
|
||||
name: trollibox
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
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
|
19
roles/music/templates/trollibox.service
Normal file
19
roles/music/templates/trollibox.service
Normal file
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# Managed by Ansible
|
||||
#
|
||||
|
||||
[Unit]
|
||||
Description=Trollibox
|
||||
After=mpd.service network.target
|
||||
Requires=mpd.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=2s
|
||||
ExecStart=/opt/trollibox/bin/trollibox -conf /etc/trollibox.yaml
|
||||
User={{ music_audio_user }}
|
||||
Group={{ music_audio_user }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Reference in a new issue