win_reboot - Reboot a windows machine

New in version 2.1.


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


parameter required default choices comments
no 5
Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again
no Reboot initiated by Ansible
Message to display to users
no 2
Seconds for shutdown to wait before requesting reboot
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)
no 600
Maximum seconds to wait for shutdown to occur
Increase this timeout for very slow hardware, large update applications, etc
no whoami
Command to expect success for to determine the machine is ready for management


# 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_sec: 3600
    reboot_timeout_sec: 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



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


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


This module is maintained by those with core commit privileges

For more information on what this means please read Module Support

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