chore: backup infrastructure configurations [skip ci]
This commit is contained in:
34
nomad_backup/port-discovery.hcl
Normal file
34
nomad_backup/port-discovery.hcl
Normal file
@@ -0,0 +1,34 @@
|
||||
job "port-discovery" {
|
||||
datacenters = ["dc1"]
|
||||
type = "batch"
|
||||
|
||||
group "scan" {
|
||||
count = 1
|
||||
constraint {
|
||||
attribute = "${attr.unique.hostname}"
|
||||
value = "odroid6"
|
||||
}
|
||||
|
||||
task "scan" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "busybox"
|
||||
network_mode = "host"
|
||||
command = "sh"
|
||||
args = ["local/scan.sh"]
|
||||
}
|
||||
template {
|
||||
data = <<EOF
|
||||
#!/bin/sh
|
||||
TARGET="192.168.4.227"
|
||||
for p in 8085 8086 8087; do
|
||||
echo "Testing $p..."
|
||||
nc -zv -w 3 $TARGET $p 2>&1 | grep -q "refused" && echo "MATCH: $p is AVAILABLE (Refused)"
|
||||
nc -zv -w 3 $TARGET $p 2>&1 | grep -q "succeeded" && echo "BUSY: $p is IN USE"
|
||||
done
|
||||
EOF
|
||||
destination = "local/scan.sh"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user