Hi Trond,

I use these tasks to reboot servers. These work fine for CentOS 6 and 7 
servers.

- shell: sleep 5 && shutdown -r "{{ '1' if 
ansible_distribution_major_version == '7' else 'now' }}"
- local_action: wait_for host={{ ansible_hostname }} port=22 timeout=300 
delay=90 state=started

Hope this helps.

Regards,
Vikas


On Friday, 9 October 2015 00:00:33 UTC+11, Trond Hindenes wrote:
>
> Hi all,
> As part of a playbook I reboot nodes if they're missing a file I'm 
> checking against. This is done like so:
>
> - name: Reboot node if check file does not exist (we assume this is the 
> first run)
>   command: shutdown -r now "Ansible updates triggered"
>   when: reboot_check_file.stat.exists == False
>   async: 0
>   poll: 0
>   ignore_errors: true
>
> However, whatever I do I always get a "exception: SSH Error: Shared 
> connection to app10002 closed". How can I force ansible to continue running 
> although it lost its connection?
>

-- 
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/fa102759-dc5f-4676-8d33-124fed2d9f49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to