ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit 0060bcb9e32872c4fb8926888040a794500df6da
parent 3fab1f9158e5ac2772c2d40ff729a97a59c7842f
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 6 Mar 2021 00:10:30 +0100

configuration/lollo: add webmusic-nginx on music.home.ctu.cx
1 file changed, 61 insertions(+), 4 deletions(-)
M
configuration/lollo.yml
|
65
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
diff --git a/configuration/lollo.yml b/configuration/lollo.yml
@@ -17,6 +17,7 @@ system:
     - unzip
     - wget
     - curl
+    - webmusic-nginx
   users:
     - name: leah
       groups: "wheel"

@@ -161,10 +162,11 @@ files:
     mode:    "0755"
     owner:   "root"
     group:   "root"
-  /var/lib/powermeter-archive:
-    state:   "directory"
-    mode:    "0755"
-    owner:   "leah"
+  /etc/nginx/passwd/music.ctu.cx:
+    state:   "file"
+    content: "{{ lookup('diskcache', 'passwordstore', 'Server/taurus/passwd/music.ctu.cx returnall=true')}}"
+    mode:    "0600"
+    owner:   "http"
     group:   "http"
 
 services:

@@ -199,6 +201,9 @@ services:
       dnsmasq.home.ctu.cx:
         renewTasks:
           - systemctl restart nginx
+      music.home.ctu.cx:
+        renewTasks:
+          - systemctl restart nginx
       influx.home.ctu.cx:
         renewTasks:
           - systemctl restart nginx

@@ -219,7 +224,31 @@ services:
 
   nginx:
     enable: true
+    enableXSLTFilter: true
     sslOnly: true
+    extraConfig: "
+      server {
+              server_name webmusic.local;
+              listen 81;
+
+              access_log off;
+
+              allow 127.0.0.1;
+              deny all;
+
+              root '/home/leah/syncthing/Music (Originals)';
+
+              location / {
+                      autoindex on;
+                      autoindex_exact_size off;
+
+                      autoindex_format xml;
+                      xslt_string_param domain $http_domain;
+                      xslt_string_param path $uri;
+                      xslt_stylesheet /usr/share/webapps/webmusic-nginx/webmusic-playlist.xslt;
+              }
+      }
+    "
     vhosts:
       lollo.ctu.cx:
         defaultserver: true

@@ -241,6 +270,33 @@ services:
           enable: true
           cert: "/var/lib/acme-redirect/live/dnsmasq.home.ctu.cx/fullchain"
           privkey: "/var/lib/acme-redirect/live/dnsmasq.home.ctu.cx/privkey"
+      music.home.ctu.cx:
+        root: "'/home/leah/syncthing/Music (Originals)'"
+        ssl:
+          enable: true
+          cert: "/var/lib/acme-redirect/live/music.home.ctu.cx/fullchain"
+          privkey: "/var/lib/acme-redirect/live/music.home.ctu.cx/privkey"
+        locations:
+          - path: "~ ^(.*/)$"
+            directoryListing: true
+            extraConfig: "
+              auth_basic 'Auth required';
+              auth_basic_user_file /etc/nginx/passwd/music.ctu.cx;
+
+              autoindex_format xml;
+              xslt_string_param path $uri;
+              xslt_stylesheet /usr/share/webapps/webmusic-nginx/webmusic.xslt;
+            "
+          - path: "~(.*)playlist.m3u$"
+            extraConfig: "
+              set $url http://127.0.0.1:81$1;
+              proxy_pass $url;
+              proxy_set_header Domain $scheme://$host;
+              proxy_hide_header 'Content-Type';
+              add_header 'Content-Type' 'text/plain';
+            "
+          - path: /assets/
+            extraConfig: "alias /usr/share/webapps/webmusic-nginx/;"
 
   hostapd:
     enable: false

@@ -278,6 +334,7 @@ services:
       - home.ctu.cx,                        195.39.246.33,   2a0f:4ac0:acab::1
       - legacy.home.ctu.cx,                 195.39.246.33,   2a0f:4ac0:acab::1
       - dnsmasq.home.ctu.cx,                195.39.246.33,   2a0f:4ac0:acab::1
+      - music.home.ctu.cx,                  195.39.246.33,   2a0f:4ac0:acab::1
       - influx.home.ctu.cx,                 195.39.246.33,   2a0f:4ac0:acab::1
 #      - home.flauschekatze.space,           195.39.246.33,   2a0f:4ac0:acab::1
 #      - legacy.home.flauschekatze.space,    195.39.246.33,   2a0f:4ac0:acab::1