summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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