name: Restart zookeeper followers
throttle: 1
any_errors_fatal: true
shell: |
systemctl restart {{zookeeper_service_name}}
timeout 22 sh -c 'until nc localhost {{zookeeper_server_port}}; do sleep 1; done'
when: not 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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/67ca5f13-855d-4d40-a47a-c0fbe11ea3b5n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3370b143-050a-4a14-a858-f5abe60c2678n%40googlegroups.com.
tasks:
- name: block check
block:
- name: run this shell
shell: 'systemctl restart "{{zookeeper_service_name}}"'
- name: debug
debug:
msg: "running my task"
- name: now run this task
shell: timeout -k 3 1m sh -c 'until nc -zv localhost {{hostvars[inventory_hostname].zk_port}}; do sleep 1; done'
when:
- not zkmode is search('leader')
serial: 1
~
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/69417f84-b761-4008-8284-ac644d3384f7n%40googlegroups.com.
- name: One host at a time
hosts: ducks_in_a_row
serial: 1
max_fail_percentage: 0
tasks:
- task1
- task2
- task3
Read up on serial
and max_fail_percentage
. Blocks don't come into it.To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/69417f84-b761-4008-8284-ac644d3384f7n%40googlegroups.com.
-- Todd
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f52dca30-05ac-49ad-9622-5539f037cdf0n%40googlegroups.com.