W3cubDocs

/Ansible

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_sec
no 5
Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again
pre_reboot_delay_sec
no 2
Seconds for shutdown to wait before requesting reboot
reboot_timeout_sec
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)
shutdown_timeout_sec
no 600
Maximum seconds to wait for shutdown to occur
Increase this timeout for very slow hardware, large update applications, etc
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_sec: 3600
    reboot_timeout_sec: 3600

Return Values

Common return values are documented here Common 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

This is a Core Module

For more information on what this means please read Core Modules

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

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_reboot_module.html