Skip to content

Commit

Permalink
add user process check
Browse files Browse the repository at this point in the history
Signed-off-by: Diane Wang <dianew@vmware.com>
  • Loading branch information
Tomorrow9 committed Nov 20, 2023
1 parent 30633e6 commit 812b09b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 34 deletions.
2 changes: 2 additions & 0 deletions common/get_guest_system_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- 'ansible_os_product_type'
- 'ansible_pkg_mgr'
- 'ansible_system'
- 'ansible_hostname'

- name: "Set facts of guest OS system info"
ansible.builtin.set_fact:
Expand All @@ -43,3 +44,4 @@
guest_os_ansible_pkg_mgr: "{{ guest_system_info.ansible_pkg_mgr | default('') }}"
guest_os_family: "{{ guest_system_info.ansible_os_family | default('') }}"
guest_os_product_type: "{{ guest_system_info.ansible_os_product_type | default('') }}"
guest_os_hostname: "{{ guest_system_info.ansible_hostname | default('') }}"
1 change: 1 addition & 0 deletions windows/utils/get_windows_system_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- "Guest OS product type: {{ guest_os_product_type }}"
- "Guest OS build number: {{ guest_os_build_num }}"
- "Guest OS edition: {{ guest_os_edition }}"
- "Guest OS hostname: {{ guest_os_hostname }}"
- "Guest OS should contain inbox drivers: {{ guest_os_with_inbox_drivers }}"

- name: "Set fact of VM guest OS type"
Expand Down
28 changes: 0 additions & 28 deletions windows/utils/win_get_vmtools_process_info.yml

This file was deleted.

19 changes: 13 additions & 6 deletions windows/wintools_complete_install_verify/verify_vmtools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,26 @@
msg: "Service '{{ item.key }}' status is: {{ item.value }}"
with_dict: "{{ vmtools_service_dict }}"

- name: "Get the user names of VMware Tools processes"
- name: "Set fact of expected usernames of VMware Tools processes"
ansible.builtin.set_fact:
win_vmtoolsd_username_list: ["NT AUTHORITY\SYSTEM", "{{ guest_os_hostname }}\\{{ vm_username }}"]
- name: "Get usernames of VMware Tools processes in guest OS"
include_tasks: ../utils/win_execute_cmd.yml
vars:
win_powershell_cmd: "(Get-Process vmtoolsd -IncludeUserName).UserName"
- name: "Check the user names of VMware Tools processes"
- name: "Check usernames of VMware Tools processes"
ansible.builtin.assert:
that:
- win_powershell_cmd_output.stdout_lines is defined
- win_powershell_cmd_output.stdout_lines | length == 2
- win_powershell_cmd_output.stdout_lines[0] is match("*\SYSTEM")
- win_powershell_cmd_output.stdout_lines[1] is match("*\vm_username")
fail_msg: "Get user names '{{ win_powershell_cmd_output.stdout_lines | default('') }}', which are not expected '*\SYSTEM' and '*\{{ vm_username }}'."
success_msg: "Get user names '*\SYSTEM' and '*\{{ vm_username }}' of VMware Tools processes."
- win_powershell_cmd_output.stdout_lines | sort == win_vmtoolsd_username_list | sort
fail_msg: >-
Get usernames of 'vmtoolsd' processes:
{{ win_powershell_cmd_output.stdout_lines | default('') }},
expected ones are {{ win_vmtoolsd_username_list }}.
success_msg: >-
Get usernames of 'vmtoolsd' processes:
{{ win_powershell_cmd_output.stdout_lines }}.
- name: "Get problem device after VMware Tools install"
include_tasks: ../utils/win_get_problem_device.yml
Expand Down

0 comments on commit 812b09b

Please sign in to comment.