From 5aecdd3ba6e67019eda7adcfa6bb5f2a3cce5081 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Thu, 25 Jul 2019 17:02:32 +0530 Subject: [PATCH] infra-playbooks: rewite a condition for better readability Use facility built-in in Ansible to check whether a command was executed successfully rather looking at its return value. Signed-off-by: Rishabh Dave --- infrastructure-playbooks/shrink-mgr.yml | 3 +-- infrastructure-playbooks/shrink-rbdmirror.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/infrastructure-playbooks/shrink-mgr.yml b/infrastructure-playbooks/shrink-mgr.yml index 4457c651e..4063b6fde 100644 --- a/infrastructure-playbooks/shrink-mgr.yml +++ b/infrastructure-playbooks/shrink-mgr.yml @@ -43,8 +43,7 @@ - name: exit playbook, if can not connect to the cluster command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} health" register: ceph_health - until: ceph_health.rc - failed_when: ceph_health.rc != 0 + until: ceph_health is succeeded delegate_to: "{{ groups[mon_group_name][0] }}" retries: 5 delay: 2 diff --git a/infrastructure-playbooks/shrink-rbdmirror.yml b/infrastructure-playbooks/shrink-rbdmirror.yml index 85f893d9f..ba0a18be2 100644 --- a/infrastructure-playbooks/shrink-rbdmirror.yml +++ b/infrastructure-playbooks/shrink-rbdmirror.yml @@ -68,8 +68,7 @@ - name: exit playbook, if can not connect to the cluster command: "{{ container_exec_cmd | default('') }} timeout 5 ceph --cluster {{ cluster }} -s -f json" register: ceph_health - until: ceph_health.rc - failed_when: ceph_health.rc != 0 + until: ceph_health is succeeded delegate_to: "{{ groups[mon_group_name][0] }}" retries: 5 delay: 2 -- 2.39.5