From 8e5d1159e0a5f36f6758b5b09cc3ee0deaeff6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Fri, 31 Jul 2020 08:11:31 +0200 Subject: [PATCH] purge-cluster: check if rbdmap exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running `infrastructure-playbooks/purge-cluster.yml` twice, it fails the second time on the `ensure rbd devices are unmapped` task, because `rbdmap` isn't installed anymore at that point. This commit adds a check that ensures `rbdmap` is available, and skips the `ensure rbd devices are unmapped` task if it isn't. Signed-off-by: BenoƮt Knecht (cherry picked from commit a57fd7a0900e5c3d04e8b6c997c819d340565967) --- infrastructure-playbooks/purge-cluster.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index 1c615de37..a428361ed 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -88,8 +88,15 @@ - name: ensure cephfs mountpoint(s) are unmounted command: umount -a -t ceph + - name: check if rbdmap is still installed + command: command -v rbdmap + register: command_rbdmap + failed_when: false + changed_when: false + - name: ensure rbd devices are unmapped command: rbdmap unmap-all + when: command_rbdmap.rc == 0 - name: unload ceph kernel modules modprobe: