ensure-zookeeper: better match return code

Every time I open up the Zuul console for certain jobs it unrolls the
pre-playbook section in the console because it looks like this task
has a "FAILED" status.

pkill man page says that 0/1 are "process killed" and "no match"
respectively; set failed_when to >1 so these return codes don't cause
spurious failures.

Change-Id: I23112b1101c991c1714d69f7568f83c2dcd605dd
This commit is contained in:
Ian Wienand 2021-05-28 14:05:52 +10:00
parent 0fcc5ff5ac
commit 3565eb4ab8

View File

@ -52,7 +52,11 @@
- name: Ensure Zookeeper not running - name: Ensure Zookeeper not running
command: pkill -f zookeeper command: pkill -f zookeeper
ignore_errors: true register: _pkill
# 0 is killed
# 1 is no process matched
# >1 is some sort of actual error
failed_when: _pkill.rc > 1
become: true become: true
- name: Start Zookeeper - name: Start Zookeeper