Loop SSH Across Hosts
BashRun the same command on a list of hosts with -o BatchMode for key-only auth.
#!/usr/bin/env bash
set -euo pipefail
hosts=(web01 web02 web03 db01)
for h in "${hosts[@]}"; do
printf '=== %s ===\n' "$h"
ssh -o BatchMode=yes -o ConnectTimeout=5 "$h" 'uptime'
done