1

I have a task that needs to run after a reboot. I know that checking connection can be done with wait_for_connection.

I have the following draft:

- name: Reboot host
  reboot:
  • name: Wait 300 seconds, but only start checking after 60 seconds wait_for_connection: delay: 60 timeout: 300

  • name: Do some other stuff . ..

...

Does the wait_for_connection module automatically reconnects once available? Or do I have to have a seperate task for that? Is there a better way of doing this?

Thanks ahead!

1 Answers1

1

as per reboot module documentation it does what you want out of the box:

 Synopsis
 - Reboot a machine, wait for it to go down, come back up, and respond to commands.
 ...

So you do not have to manage it with a separate task!

If server you try to reboot is very slow you can increase the timout of module to wait server go back on-line correctly.

So any task you need to run after a reboot the only think you have to do is insert it after the task reboot the machine.

AtomiX84
  • 1,231