ansible / ansible.builtin / v2.4.6.0-1 / module / win_reboot Reboot a windows machine | "added in version" 2.1 of ansible.builtin" Authors: Matt Davis (@nitzmahone) stableinterface | supported by coreansible.builtin.win_reboot (v2.4.6.0-1) — module
pip
Install with pip install ansible==2.4.6.0.post1
Reboot a Windows machine, wait for it to go down, come back up, and respond to commands.
# 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
msg: default: Reboot initiated by Ansible description: - Message to display to users test_command: default: whoami description: - Command to expect success for to determine the machine is ready for management reboot_timeout: aliases: - reboot_timeout_sec default: 600 description: - 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) connect_timeout: aliases: - connect_timeout_sec default: 5 description: - Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again pre_reboot_delay: aliases: - pre_reboot_delay_sec default: 2 description: - Seconds for shutdown to wait before requesting reboot shutdown_timeout: aliases: - shutdown_timeout_sec default: 600 description: - Maximum seconds to wait for shutdown to occur - Increase this timeout for very slow hardware, large update applications, etc post_reboot_delay: aliases: - post_reboot_delay_sec default: 0 description: - 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 version_added: '2.4' version_added_collection: ansible.builtin
elapsed: description: The number of seconds that elapsed waiting for the system to be rebooted. returned: always sample: 23 type: int rebooted: description: true if the machine was rebooted returned: always sample: true type: boolean