From 8519a76173341e1fa84d4679c35927495485bb67 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 23 Jun 2016 16:38:17 -0300 Subject: Compile: sshkeys --- doc/todo.rst | 1 - share/hydra/compile | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/doc/todo.rst b/doc/todo.rst index c74f924..cce95e9 100644 --- a/doc/todo.rst +++ b/doc/todo.rst @@ -3,7 +3,6 @@ TODO - init: version control in the superproject? - metrics and alarms subsystem. -- compile: sshkey. - deploy: - lockfile. - fqdn match via local config lookup. diff --git a/share/hydra/compile b/share/hydra/compile index eb76f7d..9bd6552 100755 --- a/share/hydra/compile +++ b/share/hydra/compile @@ -34,7 +34,7 @@ echo "# Compiled configuration." >> $CONFIG echo "# Do not edit this file. Use 'hydra $HYDRA compile' instead." >> $CONFIG echo "#" >> $CONFIG -# Process stuff for each node +# Per-node configuration for node in $NODES; do # SSH public keys if [ -e "$KEYS/$node/ssh/id_rsa.pub.asc" ]; then @@ -44,3 +44,19 @@ for node in $NODES; do echo "$key: '$value'" >> $CONFIG fi done + +echo "Compiling stuff from collected facts..." + +# SSH known_hosts +echo "sshkeys:" >> $CONFIG + +for node in $NODES; do + if [ -e "$FACTS/${node}.yaml" ]; then + value="$(grep sshrsakey: $FACTS/${node}.yaml | cut -d '"' -f 2)" + + echo " $node:" >> $CONFIG + echo " ensure: 'present'" >> $CONFIG + echo " type : 'ssh-rsa'" >> $CONFIG + echo " key : '$value'" >> $CONFIG + fi +done -- cgit v1.2.3