@@ -264,20 +264,16 @@ run_ansible_playbook() {
264264 exit 1
265265 fi
266266 elif [[ " $auth_type " == " VMPASSWORD" ]]; then
267- if [[ -z " $secret_value " ]]; then
268- local password_file=" ${cmd_dir} /../WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME /password"
269- if [[ -f " $password_file " ]]; then
270- log " INFO" " Secret value is not retrieved, but local password file is present: $password_file ."
271- command=" ansible-playbook ${cmd_dir} /../src/$playbook_name .yml -i $system_hosts \
272- --extra-vars \" ansible_ssh_pass=$( cat $password_file ) \" --extra-vars @$VARS_FILE -e @$system_params \
273- -e '_workspace_directory=$system_config_folder '"
274- else
275- log " ERROR" " Error: Secret value is not retrieved, and no local password file is present."
276- exit 1
277- fi
267+ local password_file=" ${cmd_dir} /../WORKSPACES/SYSTEM/$SYSTEM_CONFIG_NAME /password"
268+ if [[ -f " $password_file " ]]; then
269+ log " INFO" " Local password file is present: $password_file ."
270+ command=" ansible-playbook ${cmd_dir} /../src/$playbook_name .yml -i $system_hosts \
271+ --extra-vars \" ansible_ssh_pass=$( cat $password_file ) \" --extra-vars @$VARS_FILE -e @$system_params \
272+ -e '_workspace_directory=$system_config_folder '"
278273 else
279- log " INFO" " Using Key Vault for password retrieval ."
274+ log " INFO" " Local password file not found. Retrieving password from Key Vault ."
280275 temp_file=$( mktemp --suffix=.password)
276+ retrieve_secret_from_key_vault " $key_vault_id "
281277 echo " $secret_value " > " $temp_file "
282278 log " INFO" " Temporary password file created: $temp_file "
283279 command=" ansible-playbook ${cmd_dir} /../src/$playbook_name .yml -i $system_hosts \
0 commit comments