-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake-emqx-inv
executable file
·30 lines (29 loc) · 1.08 KB
/
make-emqx-inv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bb
;; -*- mode: clojure; -*-
(let [[bastion-ip num-emqx num-cores num-lg] *command-line-args*
emqxs (map #(str "emqx-" % ".int.thales") (range (Integer/parseInt num-emqx)))
loadgens (map #(str "loadgen-" % ".int.thales") (range (Integer/parseInt num-lg)))
make-line (fn [emqx]
(str "ssh"
" -o StrictHostKeyChecking=no"
" -J ec2-user@"
bastion-ip
" ubuntu@"
emqx))
cores (->> emqxs
(take (Integer/parseInt num-cores))
(map make-line)
(str/join "\n"))
replicants (->> emqxs
(drop (Integer/parseInt num-cores))
(map make-line)
(str/join "\n"))
lgs (->> loadgens
(map make-line)
(str/join "\n"))
all (str/join "\n" [cores replicants])]
(spit "par-hosts.txt" all)
(spit "cores.txt" cores)
(spit "replicants.txt" replicants)
(spit "loadgens.txt" lgs)
(println all))