diff options
-rwxr-xr-x | share/hydra/compile | 36 |
1 files 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 |