Hello team,

I am trying to restart zookeeper service on all 3 nodes sequentially , we 
want restart zookeeper service one by one but it will be only run on 2nd 
server if 1st server zookeeper service was successful. How do i achieve 
this in 1 task .

task should fail if service is not properly restarted.

- name: restart zookeeper one by one on  follower first and ensure all is 
good

    throttle: 1

    service:

      name: 'confluent-zookeeper'

      state: restarted

    when: not zkmode.stdout_lines is search('leader')


  - name: check follower zookeeper are up and running

    shell: 'systemctl status confluent-zookeeper -l| grep -i error || 
systemctl status confluent-zookeeper | grep  failed'

    register: zkstatus

    failed_when: zkstatus.rc == 0


Now in this case , 1 task is getting executed on all hosts despite having 
error in logs . I want it to be failed as soon as it has error and should 
not continue on next server.



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4ef2b64e-d530-4cc0-a7f8-fa4298fe6e7fn%40googlegroups.com.

Reply via email to