-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Diane Wang <[email protected]>
- Loading branch information
Showing
16 changed files
with
272 additions
and
233 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,50 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
# Get auto Admin logon value after gosc | ||
- include_tasks: ../utils/win_execute_cmd.yml | ||
# Check logon as Administrator automatically is set in guest OS | ||
- name: "Initialize the registry value of logon as Administrator automatically" | ||
ansible.builtin.set_fact: | ||
auto_admin_logon: 0 | ||
|
||
- name: "Get logon as Administrator automatically registry value" | ||
include_tasks: ../utils/win_execute_cmd.yml | ||
vars: | ||
win_powershell_cmd: "(get-itemproperty -path 'HKLM:\\software\\microsoft\\Windows NT\\CurrentVersion\\Winlogon').AutoAdminLogon" | ||
- name: Set fact of the Admin auto logon | ||
win_powershell_cmd: >- | ||
(Get-ItemProperty -path 'HKLM:\\software\\microsoft\\Windows NT\\CurrentVersion\\Winlogon').AutoAdminLogon | ||
- name: "Set fact of logon as Administrator automatically registry value" | ||
ansible.builtin.set_fact: | ||
auto_admin_logon: "{{ win_powershell_cmd_output.stdout_lines[0] }}" | ||
- ansible.builtin.debug: | ||
msg: "Get auto Admin logon enabled value: {{ auto_admin_logon }}" | ||
when: enable_debug | ||
when: | ||
- win_powershell_cmd_output.stdout_lines is defined | ||
- win_powershell_cmd_output.stdout_lines | length != 0 | ||
|
||
- name: "Check logon as Administrator automatically is enabled" | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ auto_admin_logon | int == 1 }}" | ||
success_msg: "Logon as Administrator automatically is enabled in guest OS." | ||
fail_msg: "Logon as Administrator automatically registry value '{{ auto_admin_logon }}' is not equal to 1." | ||
|
||
- name: Get auto admin logon count value after GOSC | ||
ansible.windows.win_shell: "(get-itemproperty -path 'HKLM:\\software\\microsoft\\Windows NT\\CurrentVersion\\Winlogon').AutoLogonCount" | ||
- name: "Get number of times to logon as Administrator automatically" | ||
ansible.windows.win_shell: >- | ||
(Get-ItemProperty -path 'HKLM:\\software\\microsoft\\Windows NT\\CurrentVersion\\Winlogon').AutoLogonCount | ||
register: get_auto_logon_count | ||
delegate_to: "{{ vm_guest_ip }}" | ||
until: | ||
- get_auto_logon_count.stdout_lines is defined | ||
- get_auto_logon_count.stdout_lines | length != 0 | ||
- get_auto_logon_count.stdout_lines[0] | int == customize_autologon_count | int - 1 | ||
- get_auto_logon_count.stdout_lines[0] | int == win_gosc_spec.gosc_autologon_count | int - 1 | ||
retries: 100 | ||
delay: 3 | ||
ignore_errors: true | ||
|
||
- name: "Check auto admin logon count value after GOSC" | ||
- name: "Check number of times to logon as Administrator automatically" | ||
ansible.builtin.assert: | ||
that: | ||
- get_auto_logon_count is defined | ||
- get_auto_logon_count.stdout_lines | length != 0 | ||
- get_auto_logon_count.stdout_lines[0] | int == customize_autologon_count | int - 1 | ||
- not get_auto_logon_count.failed | ||
success_msg: "Number of times to logon as Administrator automatically is set correctly: {{ get_auto_logon_count.stdout_lines[0] }}." | ||
fail_msg: >- | ||
Auto admin logon count value after GOSC is still incorrect after 300 seconds. | ||
Current auto admin logon count value is '{{ get_auto_logon_count.stdout_lines[0] | int | default("") }}', | ||
not expected '{{ customize_autologon_count | int - 1 }}'. | ||
- ansible.builtin.debug: | ||
msg: "Get remain auto logon count: {{ get_auto_logon_count.stdout_lines[0] }}" | ||
when: enable_debug | ||
|
||
- name: Check auto admin logon enabled and count is accurate | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ auto_admin_logon | int == 1 }}" | ||
success_msg: "Auto Admin logon is enabled and customized auto logon count is accurate." | ||
fail_msg: "Auto Admin logon is not enabled." | ||
The number of times to logon as Administrator automatically is incorrect after 300 seconds. | ||
Got value '{{ get_auto_logon_count.stdout_lines[0] | default('') }}' in guest OS after GOSC, | ||
expected value is '{{ win_gosc_spec.gosc_autologon_count | int - 1 }}'. |
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,16 @@ | ||
# Copyright 2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
- name: "Wait for VM IP address after GOSC" | ||
include_tasks: ../../common/vm_wait_guest_ip.yml | ||
vars: | ||
wait_ipv4: "{{ win_gosc_spec.gosc_ip | default('') }}" | ||
|
||
- name: "Update in-memory inventory after GOSC" | ||
include_tasks: ../utils/win_update_inventory.yml | ||
when: gosc_network_type == "dhcp" | ||
|
||
- name: "Wait for guest OS hostname after GOSC" | ||
include_tasks: ../../common/vm_wait_guest_hostname.yml | ||
vars: | ||
wait_guest_hostname: "{{ win_gosc_spec.gosc_hostname }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
# Check timezone name after gos customization | ||
- ansible.builtin.debug: | ||
msg: "Configured timezone: {{ customize_timezone_name }}" | ||
when: enable_debug is defined and enable_debug | ||
- name: Check timezone in guest OS | ||
# Check timezone name after GOS customization | ||
- name: "Print timezone name in Windows GOSC spec" | ||
ansible.builtin.debug: | ||
msg: "Configured timezone in GOSC spec: {{ win_gosc_spec.gosc_timezone_name }}" | ||
|
||
- name: "Get timezone info in guest OS" | ||
include_tasks: ../utils/win_execute_cmd.yml | ||
vars: | ||
win_powershell_cmd: "tzutil /g" | ||
- name: Set fact of the timezone in guest OS | ||
|
||
- name: "Set fact of the timezone in guest OS" | ||
ansible.builtin.set_fact: | ||
timezone_after_customize: "{{ win_powershell_cmd_output.stdout_lines[0] if not win_powershell_cmd_output.failed else 'NA'}}" | ||
- ansible.builtin.debug: | ||
msg: "Get timezone after customize: {{ timezone_after_customize }}" | ||
- name: Check returned timezone name is the specified one | ||
timezone_after_gosc: "{{ win_powershell_cmd_output.stdout_lines[0] }}" | ||
when: | ||
- win_powershell_cmd_output.stdout_lines is defined | ||
- win_powershell_cmd_output.stdout_lines | length != 0 | ||
|
||
- name: "Check customized timezone in guest OS" | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ not win_powershell_cmd_output.failed }}" | ||
- "{{ win_powershell_cmd_output.stdout_lines[0] == customize_timezone_name }}" | ||
success_msg: "Check customized timezone in guest OS succeed." | ||
fail_msg: "Check customized timezone in guest OS failed." | ||
- "{{ timezone_after_gosc == win_gosc_spec.gosc_timezone_name }}" | ||
success_msg: "Timezone '{{ timezone_after_gosc }}' is set by GOSC successfully in guest OS." | ||
fail_msg: >- | ||
Got timezone in guest OS '{{ timezone_after_gosc }}', | ||
which is not the one set in GOSC sepc '{{ win_gosc_spec.gosc_timezone_name }}'. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,30 @@ | ||
# Copyright 2022-2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
- name: "Set fact of OneDrive setup exe file path for Windows 11 GA" | ||
- name: "Set fact of OneDrive setup file path for Windows 11 GA" | ||
ansible.builtin.set_fact: | ||
one_drive_setup_exe: "C:\\Windows\\SysWOW64\\OneDriveSetup.exe" | ||
when: | ||
- guest_os_ansible_distribution_ver == '10.0.22000.0' | ||
- name: Set fact of OneDrive setup exe file path | ||
when: guest_os_ansible_distribution_ver == '10.0.22000.0' | ||
|
||
- name: "Set fact of OneDrive setup file path" | ||
ansible.builtin.set_fact: | ||
one_drive_setup_exe: "C:\\Windows\\System32\\OneDriveSetup.exe" | ||
when: one_drive_setup_exe is undefined | ||
|
||
# Check OneDrive setup exe file exists | ||
- include_tasks: ../utils/win_check_file_exist.yml | ||
- name: "Check if OneDrive setup file exists" | ||
include_tasks: ../utils/win_check_file_exist.yml | ||
vars: | ||
win_check_file_exist_file: "{{ one_drive_setup_exe }}" | ||
|
||
# Uninstall OneDrive when predefined setup exe file exists | ||
- include_tasks: ../utils/win_execute_cmd.yml | ||
- name: "Uninstall OneDrive" | ||
include_tasks: ../utils/win_execute_cmd.yml | ||
vars: | ||
win_powershell_cmd: "Start-Process -NoNewWindow -Wait -FilePath {{ one_drive_setup_exe }} -ArgumentList '/uninstall'" | ||
when: | ||
- win_check_file_exist_result is defined | ||
- win_check_file_exist_result | ||
|
||
# Get installed OneDrive appx package name | ||
- include_tasks: ../utils/win_execute_cmd.yml | ||
vars: | ||
win_powershell_cmd: "(Get-AppxPackage -AllUsers | Where PackageFullName -Like '*OneDriveSync*').PackageFullName" | ||
|
||
- name: Set fact of OneDrive Sync appx package name | ||
ansible.builtin.set_fact: | ||
one_drive_appx_package_name: "{{ win_powershell_cmd_output.stdout_lines[0] }}" | ||
when: | ||
- win_powershell_cmd_output is defined | ||
- "'stdout_lines' in win_powershell_cmd_output" | ||
- win_powershell_cmd_output.stdout_lines | length != 0 | ||
- win_powershell_cmd_output.stdout_lines[0] | ||
|
||
- include_tasks: ../utils/win_execute_cmd.yml | ||
- name: "Remove OneDriveSync Appx package" | ||
include_tasks: ../utils/win_remove_appx_package.yml | ||
vars: | ||
win_powershell_cmd: "Remove-AppxPackage -Package {{ one_drive_appx_package_name }}" | ||
when: | ||
- one_drive_appx_package_name is defined | ||
- one_drive_appx_package_name | ||
win_appx_package: "OneDriveSync" |
Oops, something went wrong.