From 692379cbd1d1e56c78e9ab15c565abf9b568361c Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Fri, 15 Nov 2024 13:06:00 -0600
Subject: [PATCH] feat: dynamic create hosts inventory file

---
 .gitlab-ci.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 315d483..b51e4eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -189,7 +189,11 @@ deploy_ssh_proxy_node:
       git clone ${CI_REPOSITORY_URL} /tmp/${CI_PROJECT_NAME}
       cd /tmp/${CI_PROJECT_NAME}
       git checkout ${CI_COMMIT_REF_NAME}
-      ansible-playbook -c local -i 127.0.0.1, --extra-vars="$EXTRA_VARS" ansible/cluster.yml | tee -a /tmp/ansible.log
+      cat >> ansible/hosts<<EEOF
+      [$ENV]
+      127.0.0.1
+      EEOF
+      ansible-playbook -c local -i ansible/hosts --extra-vars="$EXTRA_VARS" ansible/cluster.yml | tee -a /tmp/ansible.log
       rm -rf /tmp/${CI_PROJECT_NAME}
       EOF
     - |
-- 
GitLab