From 7f5a53a88d05dfedf64a8234603f3feda75c0cb0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 30 Dec 2017 00:29:14 -0200 Subject: Attempt to include sshed25519key and sshecdsakey on compiled config --- share/hydra/compile | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/share/hydra/compile b/share/hydra/compile index 9439f53..e653e3f 100755 --- a/share/hydra/compile +++ b/share/hydra/compile @@ -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 -- cgit v1.2.3