Documentation

win_reboot - Reboot a windows machine

New in version 2.1.

Synopsis

  • Reboot a Windows machine, wait for it to go down, come back up, and respond to commands.

Options

parameter required default choices comments
connect_timeout
no 5
Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again

aliases: connect_timeout_sec
msg
no Reboot initiated by Ansible
Message to display to users
post_reboot_delay
(added in 2.4)
no
Seconds to wait after the reboot was successful and the connection was re-established
This is useful if you want wait for something to settle despite your connection already working

aliases: post_reboot_delay_sec
pre_reboot_delay
no 2
Seconds for shutdown to wait before requesting reboot

aliases: pre_reboot_delay_sec
reboot_timeout
no 600
Maximum seconds to wait for machine to re-appear on the network and respond to a test command
This timeout is evaluated separately for both network appearance and test command success (so maximum clock time is actually twice this value)

aliases: reboot_timeout_sec
shutdown_timeout
no 600
Maximum seconds to wait for shutdown to occur
Increase this timeout for very slow hardware, large update applications, etc

aliases: shutdown_timeout_sec
test_command
no whoami
Command to expect success for to determine the machine is ready for management

Examples

# Unconditionally reboot the machine with all defaults
- win_reboot:

# Apply updates and reboot if necessary
- win_updates:
  register: update_result
- win_reboot:
  when: update_result.reboot_required

# Reboot a slow machine that might have lots of updates to apply
- win_reboot:
    shutdown_timeout: 3600
    reboot_timeout: 3600

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
rebooted
true if the machine was rebooted
always boolean True
elapsed
The number of seconds that elapsed waiting for the system to be rebooted.
always int 23


Notes

Note

  • If a shutdown was already scheduled on the system, win_reboot will abort the scheduled shutdown and enforce its own shutdown.

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.