Update check-host.sh

This commit is contained in:
diablo committed 2026-10-10 01:18:22 +08:00
1 parent c460ee8c5b
commit a35ed3f195
1 file changed
+9 -5
+9 -5
View File
@@ -3,16 +3,20 @@ set -euo pipefail
: "${TARGET_HOSTS:?TARGET_HOSTS is not configured}" : "${TARGET_HOSTS:?TARGET_HOSTS is not configured}"
: "${SSH_USER:?SSH_USER is not configured}" : "${SSH_USER:?SSH_USER is not configured}"
echo "SSH directory:"
ls -la ~/.ssh/ 2>/dev/null || true
echo "SSH-related environment variables:" SSH_KEY="$HOME/.ssh/ansible_ed25519"
env | grep -Ei 'ssh|key' | sed 's/=.*/=<set>/'
if [[ ! -r "$SSH_KEY" ]]; then
echo "ERROR: SSH key not found: $SSH_KEY"
exit 1
fi
for host in $TARGET_HOSTS; do for host in $TARGET_HOSTS; do
echo "Connecting to $host..." echo "Connecting to $host..."
ssh \ ssh \
-i ~/.ssh/alpine_hosts \ -i "$SSH_KEY" \
-o IdentitiesOnly=yes \
-o BatchMode=yes \ -o BatchMode=yes \
-o StrictHostKeyChecking=accept-new \ -o StrictHostKeyChecking=accept-new \
"$SSH_USER@$host" \ "$SSH_USER@$host" \