]> gitweb.fluxo.info Git - hydra.git/commitdiff
Compile: sshkeys
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 23 Jun 2016 19:38:17 +0000 (16:38 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 23 Jun 2016 19:38:17 +0000 (16:38 -0300)
doc/todo.rst
share/hydra/compile

index c74f92497176c5185bbec30e388cd63016024ab2..cce95e90c2348c11aa1a444e47ebb2266fa00d51 100644 (file)
@@ -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.
index eb76f7d807c3fadb3d56ee2bf838150d5a6d5eb0..9bd655283a9090e5f0767ff5d2acca5ab616b230 100755 (executable)
@@ -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