From f56a5c6eaebf403f8e99037b25aa19cb7ae26022 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 16 Aug 2023 12:53:08 +0200 Subject: [PATCH] Add get drive customers script to all servers --- manifests/scriptreceiver.pp | 7 +++++++ templates/scriptreceiver/get_drive_customers.erb.sh | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 templates/scriptreceiver/get_drive_customers.erb.sh diff --git a/manifests/scriptreceiver.pp b/manifests/scriptreceiver.pp index 568129c..825fb1f 100644 --- a/manifests/scriptreceiver.pp +++ b/manifests/scriptreceiver.pp @@ -48,6 +48,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 { '/usr/local/bin/safer_reboot': ensure => file, content => template('sunetdrive/scriptreceiver/safer_reboot.erb'), diff --git a/templates/scriptreceiver/get_drive_customers.erb.sh b/templates/scriptreceiver/get_drive_customers.erb.sh new file mode 100755 index 0000000..62c6bd8 --- /dev/null +++ b/templates/scriptreceiver/get_drive_customers.erb.sh @@ -0,0 +1,12 @@ +#!/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 +yq -r "${filter}" < /etc/hiera/data/common.yaml +