Hi, This should help
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_strategies.html#ordering-execution-based-on-inventory Regards > On 12 Jul 2023, at 15:54, Sameer Modak <[email protected]> wrote: > > > > Hello Team, > > We have a situation where we have to run same script on all 3 machines but in > specific order like first it should be run on follower and then on leader. > > now to achieve this i have to repeat same task again with different > condition. Can it be achieve in one ??? > > > - name: Kill running java processes and start newly configured systemd > > throttle: 1 > > # ignore_errors: yes > > any_errors_fatal: true > > shell: '/bin/bash /tmp/zkcheck.sh' > > register: zkstart > > failed_when: zkstart.rc != 0 > > when: not zkmode.stdout_lines is search('leader') > > > > - name: As all followers are up now repeat kill running java cp and start > for leader > > any_errors_fatal: true > > shell: '/bin/bash /tmp/zkcheck.sh' > > register: zkstart > > failed_when: zkstart.rc != 0 > > when: zkmode.stdout_lines is search('leader') > > > -- > 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] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/80a84c53-2700-4807-afa9-45458969e395n%40googlegroups.com > > <https://groups.google.com/d/msgid/ansible-project/80a84c53-2700-4807-afa9-45458969e395n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/446C4DDB-3792-4014-9EEC-A4D660FCF5BF%40gmail.com.
