Hello,

How do I execute a reboot (if needed on Ubuntu) and wait for it to return 
instead of getting the unreachable error?

I'm currently trying to do this based on past posts and links I found:

- name: reboot system if required  command: removes=/var/run/reboot-required 
sleep 1 && shutdown -r now 'Rebooting to complete system upgrade'
  async: 1
  poll: 0
  ignore_errors: true
  register: reboot- name: wait for server to come back (if restarted)  
local_action: wait_for host={{ inventory_hostname }} state=started delay=1 
timeout=300
  when: reboot.unreachable is defined and reboot.unreachable

But this is not rebooting and the local_action is being skipped. I have a 
condition here because if a reboot wasn't necessary, I don't want to wait 
for the delay.

Thanks in advance.

Regards,
Francisco

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2fad0631-3cca-42a5-8c7a-f1aa94bd9344%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to