diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-24 11:23:51 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-24 11:23:51 -0300 |
commit | 37d3e5c6463e2b62e34ed06de3b371f5614e7376 (patch) | |
tree | 0502d81caa55292a85a3e1b378eab75c7f48e4d0 /share | |
parent | cabfc47ca80492033e3d0eee66e8445119a99d63 (diff) | |
download | hydra-37d3e5c6463e2b62e34ed06de3b371f5614e7376.tar.gz hydra-37d3e5c6463e2b62e34ed06de3b371f5614e7376.tar.bz2 |
Adds hydra_hiera_query
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/compile | 40 |
1 files changed, 8 insertions, 32 deletions
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 |