diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9416c99eb047993ab61278d5871a5b0b516dd776..93f781d10b6e2f49df1062f9d080afb6b76914c3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -84,12 +84,11 @@ testlustre:
   - heat
   before_script:
     - cd $DEFAULT_PATH
-    #- echo "$GC_KEY" > GC_KEY
-    - chmod 400 GC_KEY
     - echo "$HPCCICD_openrc" > ./$NECTAR_ALLOCATION-openrc.sh
     - sleep 60
   script:
     - echo "heat stage"
+    - chmod 400 GC_KEY
     - source ./$NECTAR_ALLOCATION-openrc.sh
     - openstack stack list
     - openstack stack create --wait --template heat/lustre_HOT.yaml --parameter "project_name=$STACKNAME" $STACKNAME
@@ -110,11 +109,11 @@ build_cluster_cicd:
   - heat
   before_script:
     - cd $DEFAULT_PATH
-    - chmod 400 GC_KEY
     - echo "$HPCCICD_openrc" > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "heat stage"
     #- source ./$NECTAR_ALLOCATION-openrc.sh
+    - chmod 400 GC_KEY
     - openstack stack list
     - bash -x ./heat/heatcicdwrapper.sh create_or_update $STACKNAME
     - bash -x ./heat/server_rebuild.sh all
@@ -132,10 +131,10 @@ ansible_create_cluster_stage:
   - ansible
   before_script:
     - cd $DEFAULT_PATH/..
-    - chmod 400 GC_KEY
     - echo "$HPCCICD_openrc" > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "ansible_create_cluster_stage"
+    - chmod 400 GC_KEY
     - bash -x ./CICD/ansible_create_cluster_script.sh
     - cd CICD
     - ansible-playbook -i files/inventory.$STACKNAME --key-file ../GC_KEY --skip-tags SiteSpecific master_playbook.yml
@@ -154,11 +153,10 @@ tests:
   tags:
   - ansible
   before_script:
-    #- echo "$GC_KEY" > GC_KEY
-    - chmod 400 GC_KEY
     - echo "$HPCCICD_openrc" > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - echo "tests stage"
+    - chmod 400 GC_KEY
     - source ./$NECTAR_ALLOCATION-openrc.sh
     - openstack stack list
     - cd CICD
@@ -174,8 +172,6 @@ tests:
     - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../GC_KEY -a "systemctl is-active --quiet mariadb" SQLNodes
     - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../GC_KEY -a "systemctl is-active --quiet slurmctld" ManagementNodes
     - ansible -B 30 -i files/inventory.$STACKNAME --key-file ../GC_KEY -a "systemctl is-active --quiet slurmdbd" ManagementNodes
-
-
     - bash -e ./tests/run_tests.sh all "files/inventory.$STACKNAME" "../GC_KEY"
     - bash -e ./tests/run_tests.sh ComputeNodes "files/inventory.$STACKNAME" "../GC_KEY"
     - bash -e ./tests/run_tests.sh LoginNodes "files/inventory.$STACKNAME" "../GC_KEY"
@@ -213,11 +209,10 @@ manual_cluster_spawn:
     - echo "for this to work you have to provide a variable called manual stackname"
     - echo I still need to handle os password
     - echo $MANUAL_STACKNAME
-    - echo "$GC_KEY" > GC_KEY
-    - chmod 400 GC_KEY
     - echo "$HPCCICD_openrc" > ./$NECTAR_ALLOCATION-openrc.sh
   script:
     - source ./$NECTAR_ALLOCATION-openrc.sh
+    - chmod 400 GC_KEY
     - bash -x ./CICD/heat/heatcicdwrapper.sh create $MANUAL_STACKNAME ${CI_PROJECT_NAME}
     - openstack stack list
     - export STACKNAME=$MANUAL_STACKNAME