diff --git a/manifests/scriptreceiver.pp b/manifests/scriptreceiver.pp index 568129c..84c5fae 100644 --- a/manifests/scriptreceiver.pp +++ b/manifests/scriptreceiver.pp @@ -55,6 +55,13 @@ class sunetdrive::scriptreceiver() owner => 'root', group => 'root', } + file { '/usr/local/bin/get_drive_customers': + ensure => file, + content => template('sunetdrive/scriptreceiver/get_drive_customers.erb.sh'), + mode => '0744', + owner => 'root', + group => 'root', + } file { '/root/.bashrc': ensure => file, content => template('sunetdrive/scriptreceiver/baschrc.erb.sh'), diff --git a/templates/scriptreceiver/get_drive_customers.erb.sh b/templates/scriptreceiver/get_drive_customers.erb.sh new file mode 100755 index 0000000..388ef30 --- /dev/null +++ b/templates/scriptreceiver/get_drive_customers.erb.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mode=${1} +if [[ "${mode}" == "multi" ]]; then + filter='.multinode_mapping| keys | join("\n")' +elif [[ "${mode}" == "single" ]]; then + filter='.singlenodes| join("\n")' +else + filter='.fullnodes | join("\n")' +fi +cat /etc/hiera/data/common.yaml | yq -r "${filter}"