Update check-host.sh
This commit is contained in:
1 parent
c460ee8c5b
commit
a35ed3f195
1 file changed
+9
-5
+9
-5
@@ -3,16 +3,20 @@ set -euo pipefail
|
||||
|
||||
: "${TARGET_HOSTS:?TARGET_HOSTS 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:"
|
||||
env | grep -Ei 'ssh|key' | sed 's/=.*/=<set>/'
|
||||
SSH_KEY="$HOME/.ssh/ansible_ed25519"
|
||||
|
||||
if [[ ! -r "$SSH_KEY" ]]; then
|
||||
echo "ERROR: SSH key not found: $SSH_KEY"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for host in $TARGET_HOSTS; do
|
||||
echo "Connecting to $host..."
|
||||
|
||||
ssh \
|
||||
-i ~/.ssh/alpine_hosts \
|
||||
-i "$SSH_KEY" \
|
||||
-o IdentitiesOnly=yes \
|
||||
-o BatchMode=yes \
|
||||
-o StrictHostKeyChecking=accept-new \
|
||||
"$SSH_USER@$host" \
|
||||
|
||||
Reference in new issue
Block a user