Compare commits
2
Commits
a01c3d5521
...
875f3da03d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
875f3da03d | ||
|
|
9965e30152 |
Generated
+4
-4
@@ -226,12 +226,12 @@
|
||||
"rev": "b96631c374682088088b3d679359d192a0ae74d6",
|
||||
"revCount": 35,
|
||||
"type": "git",
|
||||
"url": "ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git"
|
||||
"url": "https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "main",
|
||||
"type": "git",
|
||||
"url": "ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git"
|
||||
"url": "https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git"
|
||||
}
|
||||
},
|
||||
"radiantwave-dev": {
|
||||
@@ -246,12 +246,12 @@
|
||||
"rev": "e401bd4ec59d1ef4f2e8b117b5933293615a19f6",
|
||||
"revCount": 27,
|
||||
"type": "git",
|
||||
"url": "ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git"
|
||||
"url": "https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "dev",
|
||||
"type": "git",
|
||||
"url": "ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git"
|
||||
"url": "https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
disko.url = "github:nix-community/disko";
|
||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
|
||||
radiantwave.url = "git+ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git?ref=main";
|
||||
radiantwave-dev.url = "git+ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git?ref=dev";
|
||||
radiantwave.url = "git+https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git?ref=main";
|
||||
radiantwave-dev.url = "git+https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git?ref=dev";
|
||||
# radiantwave-old.url = "git+ssh://git@gitea.radiantwavetech.com:2222/RadiantWaveTech/radiantwave.git?ref=main";
|
||||
nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi/main";
|
||||
};
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env zsh
|
||||
#
|
||||
# find_systems.zsh
|
||||
# Sweeps a subnet for hosts with SSH open, then queries each as `kiosk`
|
||||
# for hostname + NixOS configuration revision.
|
||||
#
|
||||
# Usage: ./find_systems.zsh [subnet]
|
||||
# subnet defaults to 192.168.4.0/24
|
||||
|
||||
set -uo pipefail # no -e: we want to keep going past unreachable hosts
|
||||
|
||||
SUBNET="${1:-192.168.4.0/24}"
|
||||
SSH_USER="kiosk"
|
||||
SSH_OPTS=(-o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new)
|
||||
|
||||
echo "Scanning $SUBNET for open SSH (22)..."
|
||||
ips=("${(@f)$(nmap -p 22 --open -Pn "$SUBNET" -oG - | awk '/22\/open/ {print $2}')}")
|
||||
|
||||
if [[ ${#ips[@]} -eq 0 ]]; then
|
||||
echo "No hosts with open SSH found on $SUBNET."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Found ${#ips[@]} host(s). Querying..."
|
||||
echo
|
||||
|
||||
fail_count=0
|
||||
|
||||
for ip in "${ips[@]}"; do
|
||||
echo "== $ip =="
|
||||
if ssh "${SSH_OPTS[@]}" "${SSH_USER}@${ip}" \
|
||||
'echo "host: $(hostname)"; echo "rev: $(nixos-version --configuration-revision)"'; then
|
||||
:
|
||||
else
|
||||
echo " (unreachable or auth failed)"
|
||||
((fail_count++))
|
||||
fi
|
||||
echo
|
||||
done
|
||||
|
||||
echo "Done. ${fail_count} of ${#ips[@]} host(s) failed to respond."
|
||||
Reference in New Issue
Block a user