diff --git a/get_modules.sh b/get_modules.sh
index d853a4679305d44b9d1a1d23a3dd24b3cb6ce7f5..1153ac4226c6797aacf04c50a532f51c2529b098 100755
--- a/get_modules.sh
+++ b/get_modules.sh
@@ -11,10 +11,16 @@ if [ ! -z "$STATE" ]; then
   exit 0
 fi
 
-if hostname -f | grep -q "bullx"; then
+CLUSTER=$(echo $CLUSTERNAME)
+if [ -z "$CLUSTER" ]; then
+   echo "CLUSTERNAME not defined"
+   exit 1
+fi
+
+if [ "$CLUSTER" == "ANSELM"] ; then
   ml --show-hidden -t av 2>&1 | awk '{print $1 ",1"}' | grep -v -e '/,\|:' | sort -u > anselm.csv
   ./modules.py > anselm.md
-else
+elif [ "$CLUSTER" == "SALOMON" ]; then
   ml --show-hidden -t av 2>&1 | awk '{print $1 ",2"}' | grep -v -e '/,\|:' | sort -u > salomon.csv
   ./modules.py > salomon.md