From 8c0ee8bca2cd460080a1c544de92b644c2856925 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sat, 24 Apr 2021 19:27:10 +0200 Subject: icecast: make shoutcast compatible configs possible --- inventory/host_vars/sgg-icecast.yml | 10 +++---- roles/streaming/icecast/defaults/main.yml | 6 ++++- roles/streaming/icecast/templates/icecast.xml.j2 | 33 ++++++++++++++++------- roles/streaming/icecast/templates/pod-spec.yml.j2 | 10 +++++-- spreadspace/host_vars/sgg-icecast.yml | 27 +++++++------------ 5 files changed, 49 insertions(+), 37 deletions(-) diff --git a/inventory/host_vars/sgg-icecast.yml b/inventory/host_vars/sgg-icecast.yml index eef28af6..6f88219b 100644 --- a/inventory/host_vars/sgg-icecast.yml +++ b/inventory/host_vars/sgg-icecast.yml @@ -58,10 +58,11 @@ kubernetes_standalone_cni_variant: with-portmap icecast_instances: schlagergarten: image_version: 2021-04-23.1 - port: 8080 + listeners: + - port: 8080 + shoutcast_mountpoint: /live.mp3 source_password: "{{ vault_icecast_secrets['schlagergarten'].source_password }}" - relay_password: "{{ vault_icecast_secrets['schlagergarten'].relay_password }}" admin: username: admin password: "{{ vault_icecast_secrets['schlagergarten'].admin_password }}" @@ -69,8 +70,3 @@ icecast_instances: hostname: "{{ external_ip }}" location: Graz/Austria contact: bussi@schlagergartengloria.at - - mountpoints: - '/live.mp3': - username: live - password: "{{ vault_icecast_secrets['schlagergarten'].mountpoint_passwords['live.mp3'] }}" diff --git a/roles/streaming/icecast/defaults/main.yml b/roles/streaming/icecast/defaults/main.yml index 673284fd..ba5bd99f 100644 --- a/roles/streaming/icecast/defaults/main.yml +++ b/roles/streaming/icecast/defaults/main.yml @@ -4,7 +4,10 @@ icecast_base_path: /srv/icecast # icecast_instances: # example: # image_version: 2021-04-23.1 -# port: 8080 +# listeners: +# - port: 8000 +# shoutcast_mountpoint: /stream +# - port: 8080 # source_password: quite-secret # relay_password: quite-secret @@ -17,6 +20,7 @@ icecast_base_path: /srv/icecast # location: Graz/Austria # contact: icecast@example.com +# ## optional # mountpoints: # '/test.mp3': # username: ## optional diff --git a/roles/streaming/icecast/templates/icecast.xml.j2 b/roles/streaming/icecast/templates/icecast.xml.j2 index 3bf0044a..60f6000f 100644 --- a/roles/streaming/icecast/templates/icecast.xml.j2 +++ b/roles/streaming/icecast/templates/icecast.xml.j2 @@ -1,9 +1,5 @@ - - 8080 - - 5 524288 @@ -15,8 +11,12 @@ +{% if 'source_password' in item.value %} {{ item.value.source_password }} +{% endif %} +{% if 'relay_password' in item.value %} {{ item.value.relay_password }} +{% endif %} {{ item.value.admin.username }} {{ item.value.admin.password }} @@ -32,21 +32,34 @@ {% endif %} + +{% for listener in item.value.listeners %} + + {{ listener.port }} +{% if 'shoutcast_mountpoint' in listener %} + {{ listener.shoutcast_mountpoint }} +{% endif %} + + +{% endfor %} + +{% if 'mountpoints' in item.value %} -{% for mountpoint, config in item.value.mountpoints.items() %} +{% for mountpoint, config in item.value.mountpoints.items() %} {{ mountpoint }} -{% if 'username' in config %} +{% if 'username' in config %} {{ config.username }} -{% endif %} +{% endif %} {{ config.password }} -{% if 'max_listeners' in config %} +{% if 'max_listeners' in config %} {{ config.max_listeners }} -{% endif %} +{% endif %} -{% endfor %} +{% endfor %} +{% endif %} 1 diff --git a/roles/streaming/icecast/templates/pod-spec.yml.j2 b/roles/streaming/icecast/templates/pod-spec.yml.j2 index 5dc0b086..bac1ac3b 100644 --- a/roles/streaming/icecast/templates/pod-spec.yml.j2 +++ b/roles/streaming/icecast/templates/pod-spec.yml.j2 @@ -22,8 +22,14 @@ containers: mountPath: /srv/logs subPath: logs ports: - - containerPort: 8080 - hostPort: {{ item.value.port }} +{% for listener in item.value.listeners %} + - containerPort: {{ listener.port }} + hostPort: {{ listener.port }} +{% if 'shoutcast_mountpoint' in listener %} + - containerPort: {{ listener.port + 1 }} + hostPort: {{ listener.port + 1 }} +{% endif %} +{% endfor %} volumes: - name: home diff --git a/spreadspace/host_vars/sgg-icecast.yml b/spreadspace/host_vars/sgg-icecast.yml index c0e42963..a2fbf9c2 100644 --- a/spreadspace/host_vars/sgg-icecast.yml +++ b/spreadspace/host_vars/sgg-icecast.yml @@ -1,18 +1,11 @@ $ANSIBLE_VAULT;1.2;AES256;spreadspace -39356439616363336239303163333166353034663966653934623963326433363061646164313031 -3862333763653737313830346237636531363966326336360a646166333832303135353833303831 -33393163633339636334653337346164636663653839306662616463386633396130643062376364 -3565333734323136340a306163663337663863616633613837636364643231353138393661353163 -33306332323030336566376634616663643636663335373033363935613964333166663661656138 -34636336383532646535396135303064653664626564333666623833303930396630633663356136 -39613038373831396662623630636338636164373664656235666362313633306439613631383064 -38613733613861663666666431373234306539666638616564353034396335656434393364613532 -30643032373332646335386566373866366536643866633537353061623866666234643862306464 -38666634653539396336393235343232363664326361386566666466633931373765383463613965 -63333262666230613033326364656235313530363932643461386362363839323035336436313130 -37316138323363613632626338353630643831643332396363333264653631383061396266383530 -32633032613631643530653534653563356539373836353934383062646434383062303162393934 -33383262303137396566656333626131636430656136666664656432646431383838303137346133 -36306465333335316131626165383937313237353461616464333933333837373166336130356539 -33666666646561373735643131656235366336303362633131363436613834376338383362306334 -61316435333265626339363965353836373464613338356137393434663539336164 +39363834326634646135336332623265656639643265336365376261623735656232336431633866 +3338626436643936626538396436626435383733356662330a373538303865623430386430343034 +30613631333931373363323962373737656230303162633331333334323663336433306464646466 +3338333661393232620a303932653164376533653266656361633338323962643935343533303736 +37353863343437333362653736353031343737373836393866323762303866626231616665646535 +35396633653666633262386536623139383831313365643734633438306634353463626461363337 +32303636616337306563613937616339336334313235306563616436363438323235323863313632 +31393238346534346335333261343033623831616632343137613737663766373935623962353262 +63376333666466323866336166373636626335633561633166343535653539306138643164306632 +3833316531323761613465383437646336643763646266643032 -- cgit v1.2.3