This commit is contained in:
parent
82739c1ff0
commit
b85f878201
9 changed files with 133 additions and 0 deletions
|
@ -19,3 +19,6 @@ nginx_sites:
|
|||
music_domain: music.bitlair.nl
|
||||
acme_san_domains:
|
||||
- [ music.bitlair.nl ]
|
||||
|
||||
music_bitpanel_host: bitpanel.bitlair.nl
|
||||
music_bitpanel_port: 1337
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
music_audio_user: audio
|
||||
music_audio_user_id: 998
|
||||
music_audio_group: audio
|
||||
music_bitvis_user: bitvis
|
||||
music_librespot_user: librespot
|
||||
music_trollibox_user: trollibox
|
||||
|
||||
|
|
|
@ -2,6 +2,18 @@
|
|||
- ansible.builtin.import_tasks:
|
||||
file: ../../common/handlers/main.yaml
|
||||
|
||||
- name: restart bitvis
|
||||
ansible.builtin.systemd:
|
||||
name: bitvis
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: restart bitvis-tee
|
||||
ansible.builtin.systemd:
|
||||
name: bitvis-tee
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: restart mpd
|
||||
ansible.builtin.systemd:
|
||||
name: mpd
|
||||
|
|
|
@ -15,6 +15,19 @@
|
|||
name: audio
|
||||
system: true
|
||||
|
||||
- name: Add {{ music_audio_user }} user
|
||||
user:
|
||||
name: "{{ music_audio_user }}"
|
||||
uid: "{{ music_audio_user_id }}"
|
||||
system: true
|
||||
groups:
|
||||
- audio
|
||||
|
||||
- name: Enable linger for {{ music_audio_user }}
|
||||
copy:
|
||||
dest: "/var/lib/systemd/linger/{{ music_audio_user }}"
|
||||
content: ""
|
||||
|
||||
- name: Set PULSE_SERVER env var for all shells
|
||||
copy:
|
||||
dest: /etc/profile.d/pulse-server.sh
|
||||
|
|
50
roles/music/tasks/bitvis.yaml
Normal file
50
roles/music/tasks/bitvis.yaml
Normal file
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
- name: Install bitvis dependencies
|
||||
apt:
|
||||
name:
|
||||
- bitvis
|
||||
- bitvis-http
|
||||
|
||||
- name: Create bitvis user
|
||||
user:
|
||||
name: "{{ music_bitvis_user }}"
|
||||
system: true
|
||||
home: /var/lib/bitvis
|
||||
groups:
|
||||
- "{{ music_audio_group }}"
|
||||
|
||||
- name: Install bitvis-tee
|
||||
ansible.builtin.template:
|
||||
src: bitvis-tee.sh
|
||||
dest: /opt/bitvis-tee.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
notify: restart {{ item }}
|
||||
with_items:
|
||||
- bitvis
|
||||
- bitvis-tee
|
||||
|
||||
- name: Install service file
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}.service"
|
||||
dest: /etc/systemd/system/{{ item }}.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart {{ item }}
|
||||
with_items:
|
||||
- bitvis
|
||||
- bitvis-tee
|
||||
|
||||
- name: Enable service
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
with_items:
|
||||
- bitvis
|
||||
- bitvis-tee
|
||||
|
||||
- meta: flush_handlers
|
|
@ -11,6 +11,18 @@
|
|||
tags:
|
||||
- music_mpd
|
||||
|
||||
- name: Bitvis
|
||||
ansible.builtin.import_tasks:
|
||||
file: bitvis.yaml
|
||||
tags:
|
||||
- music_bitvis
|
||||
|
||||
- name: Import airplay
|
||||
ansible.builtin.import_tasks:
|
||||
file: airplay.yaml
|
||||
tags:
|
||||
- music_airplay
|
||||
|
||||
- name: Import trollibox
|
||||
ansible.builtin.import_tasks:
|
||||
file: trollibox.yaml
|
||||
|
|
15
roles/music/templates/bitvis-tee.service
Normal file
15
roles/music/templates/bitvis-tee.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Multiplexer for bitvis
|
||||
Before=bitvis.service
|
||||
After=bitvis-http.service
|
||||
Requires=bitvis-http.service
|
||||
PropagatesStopTo=bitvis.service
|
||||
StopPropagatedFrom=bitvis.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/screen -dmS bitvis-tee /opt/bitvis-tee.sh
|
||||
User={{ music_bitvis_user }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
10
roles/music/templates/bitvis-tee.sh
Normal file
10
roles/music/templates/bitvis-tee.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# {{ ansible_managed }}
|
||||
|
||||
loop=`mktemp --suffix -bitvis`
|
||||
mkfifo -f "$loop"
|
||||
trap "rm -f $loop" EXIT TERM
|
||||
|
||||
cat "$loop" | while true; do nc -4 -w 2 localhost 1338; done &
|
||||
nc -klp 1337 | tee "$loop" | while true; do nc -w 2 {{ music_bitpanel_host }} {{ music_bitpanel_port }}; done
|
16
roles/music/templates/bitvis.service
Normal file
16
roles/music/templates/bitvis.service
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=Audio visualizer for the bitpanel
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
ExecStart=/usr/bin/pw-jack bitvis -a localhost -p 1337 -m localhost -o 6600
|
||||
ExecStartPost=/usr/bin/sleep 4
|
||||
ExecStartPost=/usr/bin/pw-link alsa_output.usb-ASUS_Xonar_U7_MKII-00.analog-stereo:monitor_FR bitvis:input
|
||||
User={{ music_audio_user }}
|
||||
Environment="XDG_RUNTIME_DIR=/run/user/{{ music_audio_user_id }}"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue