aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/newkeys20
1 files changed, 13 insertions, 7 deletions
diff --git a/share/hydra/newkeys b/share/hydra/newkeys
index 56f9b5b..63d8254 100755
--- a/share/hydra/newkeys
+++ b/share/hydra/newkeys
@@ -10,16 +10,22 @@ function hydra_newkeys {
node="`echo $host | cut -d . -f 1`"
privkey="$PUPPET_KEYS/"$node"_id_rsa"
pubkey="$privkey.pub"
- if [ ! -e "$privkey" ] || [ ! -e "$pubkey" ]; then
- keyringer $HYDRA genpair ssh $node/ssh/id_rsa $host $privkey
- keyringer $HYDRA genpair gpg $node/gpg/key $host
-
- # Add key into puppet git repository.
- ( cd $PUPPET_KEYS && git add $(basename $privkey) $(basename $pubkey) )
+ if [ "$1" == "all" ]; then
+ hydra_genpairs
+ elif [ ! -e "$privkey" ] || [ ! -e "$pubkey" ]; then
+ hydra_genpairs
fi
done
}
+function hydra_genpairs {
+ keyringer $HYDRA genpair ssh $node/ssh/id_rsa $host $privkey
+ keyringer $HYDRA genpair gpg $node/gpg/key $host
+
+ # Add key into puppet git repository.
+ ( cd $PUPPET_KEYS && git add $(basename $privkey) $(basename $pubkey) )
+}
+
# Load.
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
@@ -30,4 +36,4 @@ if ! which keyringer &> /dev/null; then
exit 1
fi
-hydra_newkeys
+hydra_newkeys $*