On 07. nov. 2017 18:22, coach rhca wrote:
> Thanks Kai , looking for something like the server is rebooted and looks
> for the processes or service and then move to the next server reboots and
> check the service and goes to the next hosts and does the same.
You can do something like this.
- shell: sleep 2 && /sbin/shutdown -r now
async: 1
poll: 0
- wait_for:
port: 22
host: '{{ inventory_hostname }}'
search_regex: OpenSSH
delay: 10
delegate_to: localhost
- service:
name: service-name
state: started
check_mode: yes
register: r
- fail:
msg: Something went wrong
when: r.state != 'started'
But if your process is listening on a port that you can check, then you can use
wait_for directly.
--
Kai Stian Olstad
--
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/400495c5-da75-5922-2e2a-9e07773cb68c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.