Fix tests when running against SSH target

pull/81282/merge
Jordan Borean 3 months ago committed by Matt Clay
parent 81e025b414
commit 430aaa1960

@ -38,10 +38,13 @@ ansible -i ../../inventory.winrm localhost \
-e "test_shell_type=powershell" \ -e "test_shell_type=powershell" \
"$@" "$@"
# ensure the default shell is set to PowerShell # ensure the default shell is set to PowerShell - use an explicit shell
# var as a previous task set the default shell to cmd and we don't want to
# inherit the ansible-test defaults in inventory.winrm.
ansible -i ../../inventory.winrm windows \ ansible -i ../../inventory.winrm windows \
-m win_regedit \ -m win_regedit \
-a "path=HKLM:\\\\SOFTWARE\\\\OpenSSH name=DefaultShell data=C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe" \ -a "path=HKLM:\\\\SOFTWARE\\\\OpenSSH name=DefaultShell data=C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe" \
-e "ansible_shell_type=cmd" \
"$@" "$@"
ansible -i "${OUTPUT_DIR}/test_connection.inventory" windows \ ansible -i "${OUTPUT_DIR}/test_connection.inventory" windows \

@ -44,6 +44,9 @@
register: removed_shutdown_privilege register: removed_shutdown_privilege
- block: - block:
- name: reset connection to ensure privilege change takes effect
meta: reset_connection
- name: try and reboot without required privilege - name: try and reboot without required privilege
win_reboot: win_reboot:
register: fail_privilege register: fail_privilege
@ -58,6 +61,9 @@
users: '{{ removed_shutdown_privilege.removed }}' users: '{{ removed_shutdown_privilege.removed }}'
action: add action: add
- name: reset connection after adding privileges back in
meta: reset_connection
- name: Use invalid parameter - name: Use invalid parameter
reboot: reboot:
foo: bar foo: bar

Loading…
Cancel
Save