I\'m trying to reboot server running CentOS 7 on VirtualBox. I use this task:
- name: Restart server
command: /sbin/reboot
async: 0
poll:
if you're using Ansible version >=2.7, you can use reboot module as described here
The synopsis of the reboot module itself:
Reboot a machine, wait for it to go down, come back up, and respond to commands.
In a simple way, you can define a simple task like this:
- name: reboot server
reboot:
But you can add some params like test_command to test if your server is ready to take further tasks
- name: reboot server
reboot:
test_command: whoami
Hope this helps!