From 3651afd77855f8f500d002e533fdb795302f226a Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Fri, 23 Aug 2024 10:31:27 +0200 Subject: [PATCH 1/2] Initial script to list multinode customer users filtered on mail domain. --- templates/mariadb/listusersdep.sh.erb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 templates/mariadb/listusersdep.sh.erb diff --git a/templates/mariadb/listusersdep.sh.erb b/templates/mariadb/listusersdep.sh.erb new file mode 100644 index 0000000..de96b18 --- /dev/null +++ b/templates/mariadb/listusersdep.sh.erb @@ -0,0 +1,24 @@ +#!/bin/bash + +function usage () { + printf "Usage:\t%s \n" "${0##*/}" + printf "Example:\t%s uu int.uu.se\n" "${0##*/}" +} + +[[ -z "${1}" || -z "${2}" || ! "${1}" =~ ^[a-zA-Z0-9.]{1,200}$ || ! "${2}" =~ ^[a-zA-Z0-9.]{1,200}$ ]] && usage && exit 1 + +depdom="${2}" +customer="${1}" + +docker exec mariadb_db_1 /bin/bash -c 'mysql -p${MYSQL_ROOT_PASSWORD} -NB -e '\ +$'\'select JSON_PRETTY(JSON_OBJECTAGG(uid,displayname)) from ('\ +$' select nextcloud_'"${customer}"$'.oc_accounts.uid,nextcloud_'"${customer}"$'.oc_global_scale_users.displayname'\ +$' from nextcloud_'"${customer}"$'.oc_accounts,nextcloud_'"${customer}"$'.oc_global_scale_users'\ +$' where nextcloud_'"${customer}"$'.oc_accounts.uid = nextcloud_'"${customer}"$'.oc_global_scale_users.uid'\ +$' AND JSON_EXTRACT(nextcloud_'"${customer}"$'.oc_accounts.data, "$.email.value") like "%@'"${depdom}"$'\\\""'\ +$' UNION'\ +$' select nextcloud_'"${customer}"$'.oc_accounts.uid,nextcloud_'"${customer}"$'.oc_user_saml_users.displayname'\ +$' from nextcloud_'"${customer}"$'.oc_accounts,nextcloud_'"${customer}"$'.oc_user_saml_users'\ +$' where nextcloud_'"${customer}"$'.oc_accounts.uid = nextcloud_'"${customer}"$'.oc_user_saml_users.uid'\ +$' AND JSON_EXTRACT(nextcloud_'"${customer}"$'.oc_accounts.data, "$.email.value") like "%@'"${depdom}"$'\\\"") as users\'' \ +| sed 's/\\n/\n/g' From 04a3c962508a179027218674d613646441a1228b Mon Sep 17 00:00:00 2001 From: Magnus Andersson Date: Mon, 26 Aug 2024 13:03:04 +0200 Subject: [PATCH 2/2] Multinode2: disable cronjob karin bucket. --- manifests/multinode.pp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/multinode.pp b/manifests/multinode.pp index 040a783..eeffdb4 100644 --- a/manifests/multinode.pp +++ b/manifests/multinode.pp @@ -211,13 +211,13 @@ MACAddressPolicy=none' hour => '0', weekday => '0', } - if $nodenumber == '2' { - cron { 'add_back_bucket_for_karin_nordgren': - command => '(/usr/local/bin/occ nextcloud-kmh_app_1 files_external:list karin_nordgren@kmh.se && /home/script/bin/create_bucket.sh nextcloud-kmh_app_1 karin_nordgren@kmh.se karin-nordgren-drive-sunet-se) || /bin/true', - user => 'root', - minute => '*/10', - } - } +# if $nodenumber == '2' { +# cron { 'add_back_bucket_for_karin_nordgren': +# command => '(/usr/local/bin/occ nextcloud-kmh_app_1 files_external:list karin_nordgren@kmh.se && /home/script/bin/create_bucket.sh nextcloud-kmh_app_1 karin_nordgren@kmh.se karin-nordgren-drive-sunet-se) || /bin/true', +# user => 'root', +# minute => '*/10', +# } +# } $customers.each | $index, $customer | { $customer_config_full = hiera_hash($customer) $customer_config = $customer_config_full[$environment]