Ad hoc versus playbook: the win_reboot module
The ad hoc command can be simply executed as shown in the following two examples:
ansible winservers -m win_reboot ansible win servers -m win_reboot –args="msg='Reboot initiated by remote admin' pre_reboot_delay=5"
The resulting output of either command will look as follows:
![](https://static.packt-cdn.com/products/9781789532937/graphics/1a642a22-06d5-4a80-a963-239b5100aa12.png)
This playbook file contains two ways of restarting hosts using the same module:
--- - name: Reboot Windows hosts hosts: winservers fast_gathering: false tasks: - name: restart Windows hosts with default settings win_reboot - name: restart Windows hosts with personalized settings win_reboot: msg: "Reboot initiated by remote admin" pre_reboot_delay: 5
The resulting playbook output will look as follows:
![](https://static.packt-cdn.com/products/9781789532937/graphics/aa4e28fe-01a8-412b-83c9-2ef6ed2585f4.png)