@@ -301,7 +301,9 @@ run_ansible_playbook() {
301301 local filtered_config
302302 filtered_config=$( get_filtered_test_config)
303303 if [[ -n " $filtered_config " ]]; then
304- extra_vars=" --extra-vars '$filtered_config '"
304+ local temp_config_file=$( mktemp)
305+ echo " $filtered_config " > " $temp_config_file "
306+ extra_vars=" --extra-vars @$temp_config_file "
305307 fi
306308 fi
307309
@@ -384,14 +386,14 @@ run_ansible_playbook() {
384386 check_file_exists " $temp_file " \
385387 " Temporary password file not found. Please check the Key Vault secret ID."
386388 command=" ansible-playbook ${cmd_dir} /../src/$playbook_name .yml -i $system_hosts \
387- --extra-vars \" ansible_ssh_pass=$( cat $temp_file ) \" --extra-vars @$VARS_FILE -e @$system_params \
389+ --extra-vars ' ansible_ssh_pass=$( cat $temp_file ) ' --extra-vars @$VARS_FILE -e @$system_params \
388390 -e '_workspace_directory=$system_config_folder ' $extra_vars "
389391 else
390392 local password_file=" ${cmd_dir} /../WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME /password"
391393 check_file_exists " $password_file " \
392394 " password file not found in WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME directory."
393395 command=" ansible-playbook ${cmd_dir} /../src/$playbook_name .yml -i $system_hosts \
394- --extra-vars \" ansible_ssh_pass=$( cat $password_file ) \" --extra-vars @$VARS_FILE -e @$system_params \
396+ --extra-vars ' ansible_ssh_pass=$( cat $password_file ) ' --extra-vars @$VARS_FILE -e @$system_params \
395397 -e '_workspace_directory=$system_config_folder ' $extra_vars "
396398 fi
397399
@@ -411,11 +413,16 @@ run_ansible_playbook() {
411413 return_code=$?
412414 log " INFO" " Ansible playbook execution completed with return code: $return_code "
413415
414- # Clean up temporary file if it exists
416+ # Clean up temporary files if they exist
415417 if [[ -n " $temp_file " && -f " $temp_file " ]]; then
416418 rm -f " $temp_file "
417419 log " INFO" " Temporary file deleted: $temp_file "
418420 fi
421+
422+ if [[ -n " $temp_config_file " && -f " $temp_config_file " ]]; then
423+ rm -f " $temp_config_file "
424+ log " INFO" " Temporary config file deleted: $temp_config_file "
425+ fi
419426
420427 exit $return_code
421428}
0 commit comments