3
0

Refactor NGS Pulsar role: remove obsolete files and add new task and handler definitions

This commit is contained in:
NiceDevil
2025-08-24 10:05:24 +02:00
parent c17fe406f2
commit 5d3aed6890
7 changed files with 302 additions and 12 deletions

View File

@@ -0,0 +1,71 @@
# roles/install_ngs-pulsar/templates/uninstall.sh.j2
#!/bin/bash
# Enginsight Pulsar Deinstallations-Skript
echo "Stoppe Enginsight Pulsar Service..."
# Init-System erkennen und Service stoppen
if command -v systemctl >/dev/null 2>&1; then
# SystemD
echo "SystemD erkannt - stoppe und deaktiviere Service..."
# Erst clear-shield ausführen, solange die Binary noch existiert
if [ -x "{{ pulsar_install_path }}/{{ pulsar_binary_name }}" ]; then
echo "Führe clear-shield aus..."
{{ pulsar_install_path }}/{{ pulsar_binary_name }} -clear-shield 2>/dev/null || true
fi
systemctl stop enginsight-pulsar 2>/dev/null || true
systemctl disable enginsight-pulsar 2>/dev/null || true
rm -f /etc/systemd/system/enginsight-pulsar.service
systemctl daemon-reload
systemctl reset-failed enginsight-pulsar 2>/dev/null || true
elif command -v rc-service >/dev/null 2>&1; then
# OpenRC
echo "OpenRC erkannt - stoppe und deaktiviere Service..."
# Erst clear-shield ausführen, solange die Binary noch existiert
if [ -x "{{ pulsar_install_path }}/{{ pulsar_binary_name }}" ]; then
echo "Führe clear-shield aus..."
{{ pulsar_install_path }}/{{ pulsar_binary_name }} -clear-shield 2>/dev/null || true
fi
rc-service enginsight-pulsar stop 2>/dev/null || true
rc-update del enginsight-pulsar 2>/dev/null || true
rm -f /etc/init.d/enginsight-pulsar
elif command -v service >/dev/null 2>&1; then
# SysV Init oder andere
echo "Legacy Init-System erkannt - stoppe Service..."
# Erst clear-shield ausführen, solange die Binary noch existiert
if [ -x "{{ pulsar_install_path }}/{{ pulsar_binary_name }}" ]; then
echo "Führe clear-shield aus..."
{{ pulsar_install_path }}/{{ pulsar_binary_name }} -clear-shield 2>/dev/null || true
fi
service enginsight-pulsar stop 2>/dev/null || true
update-rc.d -f enginsight-pulsar remove 2>/dev/null || true
chkconfig enginsight-pulsar off 2>/dev/null || true
rm -f /etc/init.d/enginsight-pulsar
else
echo "Warnung: Konnte Init-System nicht erkennen. Manuelles Stoppen des Services erforderlich."
# Trotzdem clear-shield versuchen
if [ -x "{{ pulsar_install_path }}/{{ pulsar_binary_name }}" ]; then
echo "Führe clear-shield aus..."
{{ pulsar_install_path }}/{{ pulsar_binary_name }} -clear-shield 2>/dev/null || true
fi
fi
echo "Lösche Installationsverzeichnis..."
rm -rf "{{ pulsar_install_path }}"
echo "Lösche übergeordnetes Enginsight-Verzeichnis falls leer..."
rmdir /opt/enginsight 2>/dev/null || true
echo "Lösche Log-Verzeichnis..."
rm -rf /var/log/enginsight
echo "Enginsight Pulsar wurde erfolgreich deinstalliert."