]> gitweb.fluxo.info Git - hydra.git/commitdiff
Adding ssh-config
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 11 Apr 2014 19:28:41 +0000 (16:28 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 11 Apr 2014 19:28:41 +0000 (16:28 -0300)
TODO.md
share/hydra/ssh-config [new file with mode: 0644]

diff --git a/TODO.md b/TODO.md
index 72674c8fdabb802ff9f154fb0c313bbef3c91f41..bff16e35eaedf2145629666113caf6dcb5d07f02 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -7,6 +7,7 @@ Hydra
   - module-update: get latest commit from production branch, setup branch if need.
   - bootless: properly support `$subdevice` in parted or always use first partition (like `/dev/sdb1`).
   - newkeys: split SSH/OpenPGP check: just generate OpenPGP key if absent.
+  - ssh-config: hydra integration.
 
 Hydractl
 --------
diff --git a/share/hydra/ssh-config b/share/hydra/ssh-config
new file mode 100644 (file)
index 0000000..92945f8
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Thanks to http://paste.debian.net/93242/
+
+if [ $# -ne 1 ]; then
+  echo "Usage: ${0} nodes_dir"
+  exit 1
+fi
+
+NODESDIR=${1}
+
+if [ ! -d ${NODESDIR} ]; then
+  echo "Not a directory: ${NODESDIR}"
+  exit 1
+fi
+
+REGEXP1="\(nodo::vserver::instance\|context\)"
+REGEXP2="s/[^\"]*\"//"
+REGEXP3="s/\".*//"
+REGEXP4="s/[^']*'//"
+REGEXP5="s/'.*//"
+
+ishost=1
+
+while read l; do
+  if [ ! -z "${ishost}" ]; then
+    host=${l}
+    unset ishost
+  else
+    echo Host ${host}.sarava.org
+    echo Port 22`printf "%02d" "${l}"`
+    echo
+    ishost=1
+  fi
+done < <(grep -R "${REGEXP1}" ${NODESDIR} | sed -e "${REGEXP2}" -e "${REGEXP3}" \
+    -e "${REGEXP4}" -e "${REGEXP5}")