]> gitweb.fluxo.info Git - hydra.git/commitdiff
Compile: try a flat structure
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 23 Jun 2016 17:09:52 +0000 (14:09 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 23 Jun 2016 17:09:52 +0000 (14:09 -0300)
share/hydra/compile

index 7fdf1952bded6b9c3548da12873f472910d904e6..716742481cd3a8b0ade71870a95719910050c4ff 100755 (executable)
@@ -33,30 +33,17 @@ echo "#"                                                            >> $CONFIG
 echo "# Compiled configuration."                                    >> $CONFIG
 echo "# Do not edit this file. Use 'hydra $HYDRA compile' instead." >> $CONFIG
 echo "#"                                                            >> $CONFIG
-echo "compiled:"                                                    >> $CONFIG
-
-#
-# SSH
-#
-echo "Handling SSH keys..."
-echo "  ssh:" >> $CONFIG
-
-# Known hosts
-# From facter
-#echo "Processing known_hosts entries..."
-#echo "    hosts:" >> $CONFIG
-
-# Authorized keys
-#echo "Processing authorized_keys entries..."
-echo "    keys:" >> $CONFIG
 
+# Process stuff for each node
 for node in $NODES; do
   # Hiera doesn't accept keys with dots
-  key="`echo $node | sed -e 's/\./_/g'`"
+  node_key="`echo $node | sed -e 's/\./_/g'`"
 
+  # SSH public keys
   if [ -e "$HYDRA_FOLDER/keyring/keys/nodes/$node/ssh/id_rsa.pub.asc" ]; then
-    echo "... for $node"
+    echo "Adding SSH public key for $node..."
+    key="compiled::ssh::key::$node_key"
     value="$(keyringer $HYDRA decrypt nodes/$node/ssh/id_rsa.pub 2> /dev/null)"
-    echo "      $key: '$value'" >> $CONFIG
+    echo "$key: '$value'" >> $CONFIG
   fi
 done