From 9d715b093f2f0fdbb9c9dcc1a56dad8d0f3cad82 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 21 Nov 2010 23:02:37 -0200 Subject: New hydra action 'import-key' --- share/hydra/import-key | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 share/hydra/import-key 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 -- cgit v1.2.3