forked from vmware/ansible-vsphere-gos-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update results.log with rebasing onto vmware#497
Signed-off-by: linhuali <lli@vmware.com>
- Loading branch information
Showing
6 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
desktop_hypervisor/common/dh_host_get_vmtools_version_build.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
# Get installed VMware tools version and build number in Windows guest OS | ||
# Return: | ||
# vmtools_version: VMware tools version | ||
# vmtools_build_number: VMware tools build number | ||
# | ||
- name: Initialize VMware tools version info and file path | ||
ansible.builtin.set_fact: | ||
vmtools_info_from_vmtoolsd: '' | ||
vmtools_cmd_path: "C:\\Program Files\\VMware\\VMware Tools\\VMwareToolboxCmd.exe" | ||
vmtools_log_path: "{{ dh_host_download_path }}vmtools.txt" | ||
|
||
- name: "Get vmtools info of guest on windows host" | ||
ansible.windows.win_shell: | | ||
Start-Process -FilePath "{{ dh_host_vmrun_path }}" -ArgumentList '-T ws -gu {{ dh_vm_username }} -gp {{ dh_vm_password }} runScriptInGuest "{{ dh_vm_vmx_path }}" "" "cmd.exe /c \"{{ vmtools_cmd_path }}\" -v > \"{{ vmtools_log_path }}\""' -NoNewWindow | ||
Start-Process -FilePath "{{ dh_host_vmrun_path }}" -ArgumentList '-T ws -gu {{ dh_vm_username }} -gp {{ dh_vm_password }} CopyFileFromGuestToHost "{{ dh_vm_vmx_path }}" "{{ vmtools_log_path }}" "{{ vmtools_log_path }}"' -NoNewWindow | ||
type "{{ vmtools_log_path }}" | ||
register: win_shell_cmd_output | ||
delay: 20 | ||
retries: "{{ win_shell_cmd_retry_times | default(10) }}" | ||
until: | ||
- win_shell_cmd_output is defined | ||
- win_shell_cmd_output.stdout_lines is defined | ||
- win_shell_cmd_output.stdout_lines | length != 0 | ||
- "'build' in win_shell_cmd_output.stdout_lines[0]" | ||
ignore_errors: true | ||
delegate_to: "{{ host_machine_hostname }}" | ||
|
||
- name: Set fact of tools version and build number | ||
ansible.builtin.set_fact: | ||
vmtools_info_from_vmtoolsd: "{{ win_shell_cmd_output.stdout_lines[0] }}" | ||
vmtools_version: "{{ win_shell_cmd_output.stdout_lines[0].split(' ')[0].rsplit('.', 1)[0] }}" | ||
vmtools_build_number: "{{ win_shell_cmd_output.stdout_lines[0].split(' ')[1][1:-1].split('-')[1] }}" | ||
|
||
- name: "Print VMware Tools version and build" | ||
ansible.builtin.debug: var=vmtools_info_from_vmtoolsd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters