From 2097344867b900767efff0886aeb2a16003e7948 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 2 Jul 2021 19:00:06 +0200 Subject: [PATCH] Update to 2021-07-02 19:00 --- roles/lemonldap_ng/files/logos/navidrome.png | Bin 0 -> 9856 bytes roles/navidrome/defaults/main.yml | 35 ++++++++++++++++++++ roles/navidrome/handlers/main.yml | 4 +++ roles/navidrome/meta/main.yml | 5 +++ roles/navidrome/tasks/archive_post.yml | 7 ++++ roles/navidrome/tasks/archive_pre.yml | 23 +++++++++++++ roles/navidrome/tasks/cleanup.yml | 8 +++++ roles/navidrome/tasks/conf.yml | 6 ++++ roles/navidrome/tasks/directories.yml | 29 ++++++++++++++++ roles/navidrome/tasks/facts.yml | 11 +++++++ roles/navidrome/tasks/install.yml | 43 ++++++++++++++++++++++++ roles/navidrome/tasks/iptables.yml | 8 +++++ roles/navidrome/tasks/main.yml | 16 +++++++++ roles/navidrome/tasks/services.yml | 5 +++ roles/navidrome/tasks/user.yml | 5 +++ roles/navidrome/tasks/write_version.yml | 5 +++ roles/navidrome/templates/navidrome.service.j2 | 44 +++++++++++++++++++++++++ roles/navidrome/templates/navidrome.toml.j2 | 9 +++++ roles/navidrome/templates/post-backup.j2 | 3 ++ roles/navidrome/templates/pre-backup.j2 | 4 +++ 20 files changed, 270 insertions(+) create mode 100644 roles/lemonldap_ng/files/logos/navidrome.png create mode 100644 roles/navidrome/defaults/main.yml create mode 100644 roles/navidrome/handlers/main.yml create mode 100644 roles/navidrome/meta/main.yml create mode 100644 roles/navidrome/tasks/archive_post.yml create mode 100644 roles/navidrome/tasks/archive_pre.yml create mode 100644 roles/navidrome/tasks/cleanup.yml create mode 100644 roles/navidrome/tasks/conf.yml create mode 100644 roles/navidrome/tasks/directories.yml create mode 100644 roles/navidrome/tasks/facts.yml create mode 100644 roles/navidrome/tasks/install.yml create mode 100644 roles/navidrome/tasks/iptables.yml create mode 100644 roles/navidrome/tasks/main.yml create mode 100644 roles/navidrome/tasks/services.yml create mode 100644 roles/navidrome/tasks/user.yml create mode 100644 roles/navidrome/tasks/write_version.yml create mode 100644 roles/navidrome/templates/navidrome.service.j2 create mode 100644 roles/navidrome/templates/navidrome.toml.j2 create mode 100644 roles/navidrome/templates/post-backup.j2 create mode 100644 roles/navidrome/templates/pre-backup.j2 diff --git a/roles/lemonldap_ng/files/logos/navidrome.png b/roles/lemonldap_ng/files/logos/navidrome.png new file mode 100644 index 0000000000000000000000000000000000000000..1eac6a89ba05083eeb73461aaf96bc1dd85c2ae3 GIT binary patch literal 9856 zcmeHrXH=8hwl*E5DNRACp|_9#p+tJ`y@|At1c;OXN$3J19qAouN|j!vh=`zo(vc3L z2qHx~Qbh0u_de(BJ-++rjPc!nI~i}A?a zLz^YN)~(=8**T${ulvJtcDtt;!-J=ky&8EI!N07=FlQT>Q?^e*sP@==GQp*jC&6b= zBAkBixfM78Y8X+B`^;tX#C|@(uzbSV7ga(N$qMMlHK(`^Z{scYLcaX%s+VLZ=K+1H zXm$C6ArbW1n}+>G+mNXQNXIU3zEf}bWbgjM9?O{!FUfMLv`xM_vcu`i+0gmkNpsOL zHrW06lMCqm>G$4Yx1Tb{D`Cg)2ZGw2&i7N#ltbf z)oqKSDnX%a-p{{PNF#*7f+$mv=UH&+_-y-`dN_2%*0$03ie-J=5cFkpo1deQ?a1WHo9=uVoxVfw(OIhePQ z=Fd9(bw$ZK;No<1o9~J6%BL$Z#&)bCM;$&w?=(2Gq-UgZrb#j_AJfynZY&tOjfqO|B=xfoDVsD zmwhX1Ec_%F;y!o+31iGv{qpc(tNmMFb25TPlc8z{6%X~N`0ILE%&H~Q)T_j-r_bJU z@{QZa*3-WEjP|Un=QZuE7Ap^pk9-hA{J58hts1{mP8XBA;y|>1glPoD`WJzhtmaFH zW0FMHz?YWE8$y#S=R1#1PIP)KnC4ZukF-6u>n$!fLUp#kvGzTyp_5P zr7jq~=0`80Si$q|y45Zu@pi2)*qXFQH80Q6FLRCZr5p$7$xmM|ow|^jSwDK7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$1ofyiBQ!Y|}bNLo=XCg?>R=Wo18FBa3 zLpDkQw-nuqNxhWeh_Alh!b|y|=Z#V~5evs71JGRht@9I4>K4X;8{&ouPi^yCOn;0- z4c)U^QRRBeGCSNs4YOoU)YCTtnLm4Q-Th0sLIk+uSxhK7On#E(7VT!iLxi1lCNO<$)fOPacMBjt#+XE zat6~rzZ*1Xw$|v*n-0LF?AwL!4^J>r?T_=m57+OkXj|X^mE$U?|H}AYL&HPAutTT( zX?wNH`BgN`{O5^r!{mzRtF}MlFZsJMR(!4HE~T4V+)Qt$Ox}4|bWqnLuU@m*n~&9Q z-hCA~>s{161B=kyoFI8ee5X4Xoqa0P!^-NXW2;U(AAkFYV=0qZ^w#Z+cftYOQA8?X!VpYHnQ%xe;x6hu+!eSFfv8=k@TWU1+{v zd)dq34JIo%Qv@6|Ho{!xan;VAo}y0r+!}3uPTr+;XWHk+wS4@$k3dUJU$t7 0) | ternary('present','absent') }}" + rules: "-A INPUT -m state --state NEW -p tcp --dport {{ nd_port }} -s {{ nd_src_ip | join(',') }} -j ACCEPT" + tags: firewall,navidrome diff --git a/roles/navidrome/tasks/main.yml b/roles/navidrome/tasks/main.yml new file mode 100644 index 0000000..ca8f997 --- /dev/null +++ b/roles/navidrome/tasks/main.yml @@ -0,0 +1,16 @@ +--- + +- include: user.yml +- include: directories.yml +- include: facts.yml +- include: archive_pre.yml + when: nd_install_mode == 'upgrade' +- include: install.yml +- include: conf.yml +- include: iptables.yml + when: iptables_manage | default(True) +- include: services.yml +- include: write_version.yml +- include: archive_post.yml + when: nd_install_mode == 'upgrade' +- include: cleanup.yml diff --git a/roles/navidrome/tasks/services.yml b/roles/navidrome/tasks/services.yml new file mode 100644 index 0000000..7fa6566 --- /dev/null +++ b/roles/navidrome/tasks/services.yml @@ -0,0 +1,5 @@ +--- + +- name: Start and enable service + service: name=navidrome state=started enabled=True + tags: navidrome diff --git a/roles/navidrome/tasks/user.yml b/roles/navidrome/tasks/user.yml new file mode 100644 index 0000000..a98d234 --- /dev/null +++ b/roles/navidrome/tasks/user.yml @@ -0,0 +1,5 @@ +--- + +- name: Create navidrome user + user: name={{ nd_user }} system=True shell=/sbin/nologin + tags: navidrome diff --git a/roles/navidrome/tasks/write_version.yml b/roles/navidrome/tasks/write_version.yml new file mode 100644 index 0000000..f1093c2 --- /dev/null +++ b/roles/navidrome/tasks/write_version.yml @@ -0,0 +1,5 @@ +--- + +- name: Write installed version + copy: content={{ nd_version }} dest={{nd_root_dir }}/meta/ansible_version + tags: navidrome diff --git a/roles/navidrome/templates/navidrome.service.j2 b/roles/navidrome/templates/navidrome.service.j2 new file mode 100644 index 0000000..a5509df --- /dev/null +++ b/roles/navidrome/templates/navidrome.service.j2 @@ -0,0 +1,44 @@ +[Unit] +Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic +After=remote-fs.target network.target +AssertPathExists={{ nd_root_dir }}/data + +[Install] +WantedBy=multi-user.target + +[Service] +User={{ nd_user }} +Group={{ nd_user }} +Type=simple +ExecStart={{ nd_root_dir }}/bin/navidrome --configfile "{{ nd_root_dir }}/etc/navidrome.toml" +WorkingDirectory={{ nd_root_dir }} +TimeoutStopSec=20 +KillMode=process +Restart=on-failure + +# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html +DevicePolicy=closed +NoNewPrivileges=yes +PrivateTmp=yes +PrivateUsers=yes +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap +ReadWritePaths={{ nd_root_dir }}/data + +# You can uncomment the following line if you're not using the jukebox This +# will prevent navidrome from accessing any real (physical) devices +PrivateDevices=yes + +# You can change the following line to `strict` instead of `full` if you don't +# want navidrome to be able to write anything on your filesystem outside of +# /var/lib/navidrome. +ProtectSystem=full + +# You can uncomment the following line if you don't have any media in /home/*. +# This will prevent navidrome from ever reading/writing anything there. +ProtectHome=true diff --git a/roles/navidrome/templates/navidrome.toml.j2 b/roles/navidrome/templates/navidrome.toml.j2 new file mode 100644 index 0000000..0739e3b --- /dev/null +++ b/roles/navidrome/templates/navidrome.toml.j2 @@ -0,0 +1,9 @@ +Port = '{{ nd_port }}' +MusicFolder = '{{ nd_music_dir }}' +DataFolder = '{{ nd_root_dir }}/data' +TranscodingCacheSize = '{{ nd_transcoding_cache_size }}' +ImageCacheSize = '{{ nd_image_cache_size }}' +{% if nd_proxy_auth is defined %} +ReverseProxyUserHeader = '{{ nd_proxy_auth }}' +ReverseProxyWhitelist = '{{ nd_proxy_whitelist | join(',') }}' +{% endif %} diff --git a/roles/navidrome/templates/post-backup.j2 b/roles/navidrome/templates/post-backup.j2 new file mode 100644 index 0000000..4036bd6 --- /dev/null +++ b/roles/navidrome/templates/post-backup.j2 @@ -0,0 +1,3 @@ +#!/bin/bash -e + +rm -f {{ nd_root_dir }}/backup/* diff --git a/roles/navidrome/templates/pre-backup.j2 b/roles/navidrome/templates/pre-backup.j2 new file mode 100644 index 0000000..3a2d782 --- /dev/null +++ b/roles/navidrome/templates/pre-backup.j2 @@ -0,0 +1,4 @@ +#!/bin/bash -e + +sqlite3 {{ nd_root_dir }}/data/navidrome.db .dump | zstd -c > {{ nd_root_dir }}/backup/navidrome.sql.zst +cp {{ nd_root_dir }}/etc/navidrome.toml {{ nd_root_dir }}/backup/