win_reboot - Fix rc validation when using psrp and add extra docs (#53711)

* win_reboot - Fix rc validation when using psrp and add extra docs

* Revert boot time command and fix docs
pull/53721/head
Jordan Borean 6 years ago committed by GitHub
parent 495c197770
commit 3d23e47c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- win_reboot - Fix reboot command validation failure when running under the psrp connection plugin

@ -65,6 +65,10 @@ notes:
- If a shutdown was already scheduled on the system, C(win_reboot) will abort the scheduled shutdown and enforce its own shutdown.
- Beware that when C(win_reboot) returns, the Windows system may not have settled yet and some base services could be in limbo.
This can result in unexpected behavior. Check the examples for ways to mitigate this.
- The connection user must have the C(SeRemoteShutdownPrivilege) privilege enabled, see
U(https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/force-shutdown-from-a-remote-system)
for more information.
some Windows hosts.
seealso:
- module: reboot
author:

@ -49,7 +49,7 @@ class ActionModule(RebootActionModule, ActionBase):
def perform_reboot(self, task_vars, distribution):
shutdown_command = self.get_shutdown_command(task_vars, distribution)
shutdown_command_args = self.get_shutdown_command_args(distribution)
reboot_command = '{0} {1}'.format(shutdown_command, shutdown_command_args)
reboot_command = self._connection._shell._encode_script('{0} {1}'.format(shutdown_command, shutdown_command_args))
display.vvv("{action}: rebooting server...".format(action=self._task.action))
display.debug("{action}: distribution: {dist}".format(action=self._task.action, dist=distribution))
@ -66,7 +66,8 @@ class ActionModule(RebootActionModule, ActionBase):
display.warning('A scheduled reboot was pre-empted by Ansible.')
# Try to abort (this may fail if it was already aborted)
result1 = self._low_level_execute_command('shutdown /a', sudoable=self.DEFAULT_SUDOABLE)
result1 = self._low_level_execute_command(self._connection._shell._encode_script('shutdown /a'),
sudoable=self.DEFAULT_SUDOABLE)
# Initiate reboot again
result2 = self._low_level_execute_command(reboot_command, sudoable=self.DEFAULT_SUDOABLE)

Loading…
Cancel
Save