Restart Windows Machines With Ansible

Following this week coverage of Ansible, Today I will show you how to restart Windows managed machines with Ansible.

Manage Windows

This post follows yesterday’s blog post about how to install Windows updates with Ansible and the four-part series and managing Windows machines with Ansible.

Playbook

Below is the playbook that will restart all the machines that are in Windows inventory. The machines will restart immediately without any delay.

---
- name: "Restart hosts"
  hosts: windows
  tasks:
    - name: "Restart Windows"
      win_reboot:

Note: If you would like to postpone the reboot you can add the following line and delay the reboot (the value is in seconds).

reboot_timeout: 300

Processing…
Success! You're on the list.

Posted

in

by