aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-11-21 23:02:37 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-11-21 23:02:37 -0200
commit9d715b093f2f0fdbb9c9dcc1a56dad8d0f3cad82 (patch)
tree536b41edd82dc3cc47d39f935d442343a38139c9
parentfc1096fa3696cf31ea9fbb23ba22d67e1599684e (diff)
downloadhydra-9d715b093f2f0fdbb9c9dcc1a56dad8d0f3cad82.tar.gz
hydra-9d715b093f2f0fdbb9c9dcc1a56dad8d0f3cad82.tar.bz2
New hydra action 'import-key'
-rwxr-xr-xshare/hydra/import-key32
1 files changed, 32 insertions, 0 deletions
diff --git a/share/hydra/import-key b/share/hydra/import-key
new file mode 100755
index 0000000..b74ac1f
--- /dev/null
+++ b/share/hydra/import-key
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Import a key into nodes.
+#
+
+# Load
+source $APP_BASE/lib/hydra/functions || exit 1
+hydra_config_load
+
+# Command line arguments
+NODES="$*"
+
+# Build node list
+if [ -z "$NODES" ]; then
+ NODES="`hydra $HYDRA nodes`"
+fi
+
+# Validation
+if [ -z "$ORIGIN" ]; then
+ ORIGIN="git://git.sarava.org/hydra.git"
+fi
+
+# Deploy
+for node in $NODES; do
+ echo ""
+ echo "-----------------------------"
+ echo "Importing gpg key to $node..."
+ echo "-----------------------------"
+ echo ""
+ hostname="`echo $node | cut -d . -f 1`"
+ keyringer $HYDRA decrypt $hostname/gpg/key | ssh -o ConnectTimeout=15 $node sudo gpg --homedir /root/.gnupg --import
+done