feat(hub): rol por nodo en deploy scripts + variable role multiselect con filtro en Fleet Overview

This commit is contained in:
Egutierrez
2026-06-07 18:00:37 +02:00
parent 41a1075b91
commit ec779b6ece
3 changed files with 44 additions and 23 deletions
+5 -3
View File
@@ -12,8 +12,9 @@
# `termux-services` y `termux-api`, y un alias SSH al sshd de Termux.
set -euo pipefail
NODE="${1:?uso: deploy_agent_termux.sh <node> <ssh_alias>}"
HOST="${2:?uso: deploy_agent_termux.sh <node> <ssh_alias>}"
NODE="${1:?uso: deploy_agent_termux.sh <node> <ssh_alias> [role]}"
HOST="${2:?uso: deploy_agent_termux.sh <node> <ssh_alias> [role]}"
ROLE="${3:-movil}"
HUB="https://metrics-dxaqj3ina6eqd5pjt85wkrrj.organic-machine.com/api/v1/import/prometheus"
LOKI="https://logs-wmaxecsjcfnocz81d5luca92.organic-machine.com/loki/api/v1/push"
@@ -27,7 +28,7 @@ ssh -o BatchMode=yes "$HOST" 'mkdir -p ~/fleet-agent'
scp -q -o BatchMode=yes "$BIN" "$HOST:fleet-agent/metrics_agent"
echo ">> instalando servicio Termux en $NODE ($HOST)"
ssh -o BatchMode=yes "$HOST" "NODE='$NODE' PW='$PW' HUB='$HUB' LOKI='$LOKI' bash -s" <<'OUTER'
ssh -o BatchMode=yes "$HOST" "NODE='$NODE' PW='$PW' HUB='$HUB' LOKI='$LOKI' ROLE='$ROLE' bash -s" <<'OUTER'
set -e
PREFIX=/data/data/com.termux/files/usr
HM=/data/data/com.termux/files/home
@@ -41,6 +42,7 @@ cat > "$HM/fleet-agent/agent.json" <<JSON
"user": "fleet",
"pass": "${PW}",
"interval_sec": 15,
"labels": { "role": "${ROLE}" },
"battery_file": "$HM/fleet-agent/battery.json",
"log_file": "$HM/fleet-agent/logcat.log"
}