From b95a33a12f142ef06cb5c8300cbe155daedf38d8 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 24 Jun 2020 11:32:41 +0200 Subject: [PATCH] Modifying .gitlab-ci.yml for dependency to the correct VSphere --- .gitlab-ci.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a490dc..b78928e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,12 +15,12 @@ variables: VSPHERE_API_PORT: 443 VSPHERE_API_USER: 'Administrator@vsphere.local' VSPHERE_API_PASSWD_PROD: 'secret' - VSPHERE_DC: 'vmcc' - VSPHERE_CLUSTER: 'vmcc-l105-01' + VSPHERE_DC: '' + VSPHERE_CLUSTER: '' VSPHERE_VM_FOLDER: 'templates' MAX_NR_TEMPLATES_STAY: 4 - TEMPLATE_VM_NAME: 'template.pixelpark.com' - TEMPLATE_NAME: 'oracle-linux-7-template' + # TEMPLATE_VM_NAME: 'template.pixelpark.com' + # TEMPLATE_NAME: 'oracle-linux-7-template' VMWARE_CONFIG_VERSION: 'vmx-15' VM_OS_VERSION: 'oracleLinux7_64Guest' VM_DISK_SIZE_GB: 32 @@ -71,11 +71,23 @@ variables: VSPHERE_HOST="test-vcsa01.pixelpark.net"; fi fi' - - 'echo "VCenter Host: \"${VSPHERE_HOST}\""' + - ' if [ -z "${VSPHERE_DC}" ] ; then + if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then + VSPHERE_DC="vmcc"; + else + VSPHERE_DC="test-vmcc"; + fi + fi' + - ' if [ -z "${VSPHERE_CLUSTER}" ] ; then + if [ "$CI_COMMIT_REF_NAME" = "master" -o "$CI_COMMIT_REF_NAME" = "production" ] ; then + VSPHERE_CLUSTER="vmcc-l105-01"; + else + VSPHERE_CLUSTER="test-vmcc-l105-01"; + fi + fi' - 'CONFIG_FILE=etc/create-${OS_ID}-${SYSTEM_STATUS}.ini' - 'echo "Configuration file: \"${CONFIG_FILE}\""' - 'touch "${CONFIG_FILE}"' - - 'ls -l "${CONFIG_FILE}" || true' - 'echo "Finished common part"' tags: - deploy @@ -183,7 +195,7 @@ Create Centos8 template: ls -l "${CONFIG_FILE}" || true; echo; echo "-->"; - cat "${CONFIG_FILE}" | sed -e "s/^\(root_password\) .*/\1 = ********/"-e "s/^\(password\) .*/\1 = ********/"; + cat "${CONFIG_FILE}" | sed -e "s/^\(root_password\) .*/\1 = ********/" -e "s/^\(password\) .*/\1 = ********/"; echo "<-- EOF"' environment: name: ${SYSTEM_STATUS} -- 2.39.5