Hello,
On 21 October 2012 14:08, Gregory Shulov <
gregory...@gmail.com> wrote:
> I am trying to update kernel in playbook and reboot the server without
> existing playbook.
>
> Here is the example:
>
> # Temprorary hack that fixes mismatched kernel and kernel module versions
> - name: "Restart VM to Load new kernel"
> action: command /sbin/reboot
> only_if: "${foo.stdout} != 0"
>
>
> - name: "Pause playbook and wait for VM to boot"
> action: pause minutes=2
> only_if: "${foo.stdout} != 0"
What you need is the wait_for module.
action: command /sbin/reboot
local_action: wait_for host=${inventory_hostname} port=22 state=stopped
local_action: wait_for host=${inventory_hostname} port=22
This should wait until SSH is available. If that does not work
reliably, the host is down before the first wait_for launches for
example, you can remove the first wait_for and add a 'delay' parameter
to the second one.
Greetings,
Jeroen