]> gitweb.fluxo.info Git - hydra.git/commitdiff
Attempt to include sshed25519key and sshecdsakey on compiled config
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 02:29:14 +0000 (00:29 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 30 Dec 2017 02:29:14 +0000 (00:29 -0200)
share/hydra/compile

index 9439f53f87e7c5b57e679507edf502e3b805231d..e653e3f6d5b54aca41474dc956f05ec3b015d79d 100755 (executable)
@@ -45,18 +45,42 @@ for node in $NODES; do
   fi
 done
 
-echo "Compiling stuff from collected facts..."
+echo "Compiling data 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)"
+    rsakey="$(grep sshrsakey: $FACTS/${node}.yaml | cut -d ':' -f 2 | sed -e 's/ //g' -e 's/"//g')"
+    sshed25519key="$(grep sshed25519key: $FACTS/${node}.yaml | cut -d ':' -f 2 | sed -e 's/ //g' -e 's/"//g')"
+    sshecdsakey="$(grep sshecdsakey: $FACTS/${node}.yaml | cut -d ':' -f 2 | sed -e 's/ //g' -e 's/"//g')"
 
-    echo "  $node:" >> $CONFIG
-    echo "    ensure: 'present'" >> $CONFIG
-    echo "    type  : 'ssh-rsa'" >> $CONFIG
-    echo "    key   : '$value'"  >> $CONFIG
+    if [ ! -z "$rsakey" ]; then
+      #echo "  $node-rsa:"                      >> $CONFIG
+      echo "  $node:"                          >> $CONFIG
+      #echo "    name  : '$node'"               >> $CONFIG
+      echo "    ensure: 'present'"             >> $CONFIG
+      echo "    type  : 'ssh-rsa'"             >> $CONFIG
+      echo "    key   : '$rsakey'"             >> $CONFIG
+    fi
+
+    # See [PUP-6589] Resource Type sshkey doesn't allow the declaration of multiple SSH host keys for one host
+    # https://tickets.puppetlabs.com/browse/PUP-6589
+    #if [ ! -z "$sshed25519key" ]; then
+    #  echo "  $node-sshed25519key:"            >> $CONFIG
+    #  echo "    name  : '$node'"               >> $CONFIG
+    #  echo "    ensure: 'present'"             >> $CONFIG
+    #  echo "    type  : 'ssh-ed25519'"         >> $CONFIG
+    #  echo "    key   : '$sshed25519key'"      >> $CONFIG
+    #fi
+
+    #if [ ! -z "$sshecdsakey" ]; then
+    #  echo "  $node-sshecdsakey:"              >> $CONFIG
+    #  echo "    name  : '$node'"               >> $CONFIG
+    #  echo "    ensure: 'present'"             >> $CONFIG
+    #  echo "    type  : 'ecdsa-sha2-nistp256'" >> $CONFIG
+    #  echo "    key   : '$sshecdsakey'"        >> $CONFIG
+    #fi
   fi
 done