Compare commits
No commits in common. "7cd44bbe53622c6569eda33aeee8b1dde356ea3f" and "1d8e07bf0468a7440d4c2d26a5e68020983ea9d8" have entirely different histories.
7cd44bbe53
...
1d8e07bf04
13 changed files with 101 additions and 191 deletions
|
@ -11,10 +11,6 @@ root_access:
|
||||||
- polyfloyd
|
- polyfloyd
|
||||||
|
|
||||||
nginx_client_max_body_size: 512M
|
nginx_client_max_body_size: 512M
|
||||||
nginx_sites:
|
|
||||||
- server_name: "music.bitlair.nl"
|
|
||||||
snippets:
|
|
||||||
- "music-nginx.j2"
|
|
||||||
|
|
||||||
music_domain: music.bitlair.nl
|
music_domain: music.bitlair.nl
|
||||||
acme_san_domains:
|
acme_san_domains:
|
||||||
|
|
|
@ -6,5 +6,5 @@
|
||||||
- { role: "acme", tags: [ "acme" ] }
|
- { role: "acme", tags: [ "acme" ] }
|
||||||
- { role: "deb_forgejo", tags: [ "deb_forgejo" ] }
|
- { role: "deb_forgejo", tags: [ "deb_forgejo" ] }
|
||||||
- { role: "go", tags: [ "go" ] }
|
- { role: "go", tags: [ "go" ] }
|
||||||
- { role: "nginx", tags: [ "nginx" ] }
|
# - { role: "nginx", tags: [ "nginx" ] }
|
||||||
- { role: "music", tags: [ "music" ] }
|
- { role: "music", tags: [ "music" ] }
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
music_audio_user: audio
|
music_audio_user: audio
|
||||||
music_audio_group: audio
|
|
||||||
music_librespot_user: librespot
|
|
||||||
|
|
||||||
music_mqtt_mpd_volume: bitlair/music/space/volume
|
music_mqtt_mpd_volume: bitlair/music/space/volume
|
||||||
|
|
|
@ -2,25 +2,19 @@
|
||||||
- ansible.builtin.import_tasks:
|
- ansible.builtin.import_tasks:
|
||||||
file: ../../common/handlers/main.yaml
|
file: ../../common/handlers/main.yaml
|
||||||
|
|
||||||
- name: restart mpd
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: mpd
|
|
||||||
state: restarted
|
|
||||||
daemon_reload: true
|
|
||||||
|
|
||||||
- name: Restart trollibox
|
- name: Restart trollibox
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: trollibox
|
name: trollibox
|
||||||
state: restarted
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: rebuild librespot
|
- name: Rebuild librespot
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: /root/.cargo/bin/cargo build --release --features pulseaudio-backend
|
cmd: /root/.cargo/bin/cargo build --release --features jackaudio-backend
|
||||||
args:
|
args:
|
||||||
chdir: /opt/librespot
|
chdir: /opt/librespot
|
||||||
|
|
||||||
- name: restart librespot
|
- name: Restart librespot
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: librespot
|
name: librespot
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: Create librespot user
|
- name: Install dependencies
|
||||||
user:
|
ansible.builtin.apt:
|
||||||
name: "{{ music_librespot_user }}"
|
name: libjack-jackd2-dev
|
||||||
system: true
|
state: present
|
||||||
home: /var/lib/librespot
|
|
||||||
groups:
|
|
||||||
- "{{ music_audio_group }}"
|
|
||||||
|
|
||||||
- name: Clone librespot source
|
- name: Clone librespot source
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
|
@ -14,8 +11,8 @@
|
||||||
dest: /opt/librespot
|
dest: /opt/librespot
|
||||||
accept_hostkey: yes
|
accept_hostkey: yes
|
||||||
notify:
|
notify:
|
||||||
- rebuild librespot
|
- Rebuild librespot
|
||||||
- restart librespot
|
- Restart librespot
|
||||||
|
|
||||||
- name: Install service file
|
- name: Install service file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
@ -24,7 +21,7 @@
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
notify: restart librespot
|
notify: Restart librespot
|
||||||
|
|
||||||
- name: Enable Librespot
|
- name: Enable Librespot
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
@ -32,5 +29,3 @@
|
||||||
state: started
|
state: started
|
||||||
enabled: true
|
enabled: true
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- meta: flush_handlers
|
|
||||||
|
|
|
@ -23,3 +23,12 @@
|
||||||
file: soundboard.yaml
|
file: soundboard.yaml
|
||||||
tags:
|
tags:
|
||||||
- music_soundboard
|
- music_soundboard
|
||||||
|
|
||||||
|
- name: Install nginx config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: nginx-site.conf
|
||||||
|
dest: /etc/nginx/sites-enabled/trollibox
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
notify: Reload nginx
|
||||||
|
|
|
@ -1,32 +1,14 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Install MPD
|
- name: Install MPD
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: mpd
|
name:
|
||||||
|
- jackd
|
||||||
|
- mpd
|
||||||
|
- python3-mpd
|
||||||
|
- python3-serial
|
||||||
state: present
|
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
|
- name: Install mpd-volume-to-mqtt script
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: mpd-volume-to-mqtt.sh
|
src: mpd-volume-to-mqtt.sh
|
||||||
|
@ -52,13 +34,6 @@
|
||||||
enabled: true
|
enabled: true
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Install skipbutton depedencies
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name:
|
|
||||||
- python3-mpd
|
|
||||||
- python3-serial
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Clone skipbutton source
|
- name: Clone skipbutton source
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
repo: https://github.com/bitlair/skipbutton.git
|
repo: https://github.com/bitlair/skipbutton.git
|
||||||
|
|
|
@ -3,15 +3,16 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Spotify through Librespot
|
Description=Spotify through Librespot
|
||||||
After=network.target
|
After=network.target
|
||||||
|
Requires=jackd.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
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 jackaudio
|
||||||
Environment="PULSE_SERVER=/tmp/pipewire-pulse-socket"
|
User={{ music_audio_user }}
|
||||||
Environment="XDG_RUNTIME_DIR=/run/user/0"
|
Group={{ music_audio_user }}
|
||||||
User={{ music_librespot_user }}
|
AmbientCapabilities=CAP_IPC_LOCK,CAP_SYS_NICE
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
# {{ 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"
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
# {{ 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
|
|
|
@ -1,17 +0,0 @@
|
||||||
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
|
|
70
roles/music/templates/nginx-site.conf
Normal file
70
roles/music/templates/nginx-site.conf
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
listen 443 ssl default_server;
|
||||||
|
listen [::]:443 ssl default_server;
|
||||||
|
|
||||||
|
server_name {{ music_domain }};
|
||||||
|
|
||||||
|
{% if acme_bootstrap_certs %}
|
||||||
|
include "snippets/snakeoil.conf";
|
||||||
|
{% else %}
|
||||||
|
ssl_certificate "/var/lib/dehydrated/certs/{{ music_domain }}/fullchain.pem";
|
||||||
|
ssl_certificate_key "/var/lib/dehydrated/certs/{{ music_domain }}/privkey.pem";
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for range in trusted_ranges %}
|
||||||
|
allow {{ range.cidr }};
|
||||||
|
{% endfor %}
|
||||||
|
deny all;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
rewrite ^/(.*) https://{{ music_domain }}/trollibox/player/space?;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /trollibox/ {
|
||||||
|
proxy_pass http://[::1]:3000/;
|
||||||
|
client_max_body_size 512M;
|
||||||
|
include proxy_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/trollibox/(.+/events)$ {
|
||||||
|
proxy_pass http://[::1]:3000/$1;
|
||||||
|
include proxy_params;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
chunked_transfer_encoding off;
|
||||||
|
add_header X-Test "123";
|
||||||
|
proxy_set_header Connection '';
|
||||||
|
proxy_buffering off;
|
||||||
|
proxy_read_timeout 7d;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/trollibox/(.+/listen)$ {
|
||||||
|
proxy_pass http://[::1]:3000/$1;
|
||||||
|
include proxy_params;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_read_timeout 7d;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /bobdsp/ {
|
||||||
|
proxy_pass http://[::1]:8081/;
|
||||||
|
include proxy_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /vis/ {
|
||||||
|
allow all;
|
||||||
|
proxy_pass http://[::1]:13378/;
|
||||||
|
include proxy_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /vis/ {
|
||||||
|
rewrite ^(.*)$ /vis/index.html;
|
||||||
|
include proxy_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
include "snippets/acme.conf";
|
||||||
|
}
|
|
@ -1,49 +0,0 @@
|
||||||
{% for range in trusted_ranges %}
|
|
||||||
allow {{ range.cidr }};
|
|
||||||
{% endfor %}
|
|
||||||
deny all;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
rewrite ^/(.*) https://{{ music_domain }}/trollibox/player/space?;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /trollibox/ {
|
|
||||||
proxy_pass http://[::1]:3000/;
|
|
||||||
include proxy_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ ^/trollibox/(.+/events)$ {
|
|
||||||
proxy_pass http://[::1]:3000/$1;
|
|
||||||
include proxy_params;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
chunked_transfer_encoding off;
|
|
||||||
add_header X-Test "123";
|
|
||||||
proxy_set_header Connection '';
|
|
||||||
proxy_buffering off;
|
|
||||||
proxy_read_timeout 7d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ ^/trollibox/(.+/listen)$ {
|
|
||||||
proxy_pass http://[::1]:3000/$1;
|
|
||||||
include proxy_params;
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_read_timeout 7d;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /bobdsp/ {
|
|
||||||
proxy_pass http://[::1]:8081/;
|
|
||||||
include proxy_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /vis/ {
|
|
||||||
allow all;
|
|
||||||
proxy_pass http://[::1]:13378/;
|
|
||||||
include proxy_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = /vis/ {
|
|
||||||
rewrite ^(.*)$ /vis/index.html;
|
|
||||||
include proxy_params;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue