Hello Friends, 

Does anyone have experience using the reboot playbook on RHEL systems, i'm 
using below method and it reboots the systems but in between while system 
is rebooting it breaks the connection and does not wait for post reboot 
status like uptime, if someone already overcomed this please let me know , 
my play looks like below...

---
- name: Reboot a host and wait for it to return
  hosts: postinstall
  remote_user: root

  tasks:
    - name: check automount
      service: name=autofs state=stopped

    - name: reboot host
      shell: sleep 10 && /sbin/shutdown -r now
      async: 360
      poll: 0
      become: true

    - name: waiting for server booting up
      local_action: wait_for host="{{ inventory_hostname }}" port=22 
delay=5 timeout=360
    
  
    - name: check uptime
      local_action: shell ansible -u {{ ansible_user_id }} -m ping {{ 
inventory_hostname }}
      register: result
      until: result.rc == 0
      retries: 30
      delay: 10

    # And finally, execute 'uptime' when the host is back.
    - shell: uptime

-- 
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/ae6d87f1-5439-4f66-b4c7-d10e1057ff72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to