From 37d3e5c6463e2b62e34ed06de3b371f5614e7376 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 24 May 2018 11:23:51 -0300 Subject: Adds hydra_hiera_query --- share/hydra/compile | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) (limited to 'share/hydra/compile') diff --git a/share/hydra/compile b/share/hydra/compile index 567a78f..6d84c53 100755 --- a/share/hydra/compile +++ b/share/hydra/compile @@ -56,32 +56,8 @@ for node in $NODES; do 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')" - # Determine host aliases depending on sshd::ports config host_aliases="" - hiera="hiera --config $HYDRA_FOLDER/puppet/hiera.yaml" - hiera_params="settings::confdir=$HYDRA_FOLDER/puppet ::clientcert=$node" - role="`$hiera nodo::role $hiera_params 2> /dev/null`" - location="`$hiera nodo::location $hiera_params 2> /dev/null`" - virtual="$(grep "^virtual: " $FACTS/${node}.yaml | cut -d ':' -f 2 | sed -e 's/ //g' -e 's/"//g')" - domain="$(grep "^domain: " $FACTS/${node}.yaml | cut -d ':' -f 2 | sed -e 's/ //g' -e 's/"//g')" - - if [ ! -z "$virtual" ]; then - hiera_params="$hiera_params ::virtual=$virtual" - fi - - if [ ! -z "$role" ]; then - hiera_params="$hiera_params ::nodo::role=$role" - fi - - if [ ! -z "$location" ]; then - hiera_params="$hiera_params ::nodo::location=$location" - fi - - if [ ! -z "$domain" ]; then - hiera_params="$hiera_params ::domain=$domain" - fi - - ssh_ports="`$hiera sshd::ports $hiera_params 2> /dev/null`" + ssh_ports="`hydra_hiera_query $node sshd::ports`" if [ "$ssh_ports" != "nil" ] && [ ! -z "$ssh_ports" ]; then ssh_ports="`echo $ssh_ports | sed -e 's/\[//g' -e 's/\]//g' -e 's/,//g'`" @@ -96,15 +72,15 @@ for node in $NODES; do fi 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 + #echo " $node-rsa:" >> $CONFIG + echo " $node:" >> $CONFIG + #echo " name : '$node'" >> $CONFIG + echo " ensure : 'present'" >> $CONFIG + echo " type : 'ssh-rsa'" >> $CONFIG + echo " key : '$rsakey'" >> $CONFIG if [ ! -z "$host_aliases" ]; then - echo " host_aliases : [ $host_aliases ]" >> $CONFIG + echo " host_aliases : [ $host_aliases ]" >> $CONFIG fi fi -- cgit v1.2.3