From 19f9e200d74e48d6d54d1d021ce6e0b8798a4f9d Mon Sep 17 00:00:00 2001 From: WingkaiHo Date: Wed, 22 Mar 2017 10:00:44 +0800 Subject: [PATCH] Add auto detect the ceph cluster name --- .../recover-osds-after-ssd-journal-failure.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/infrastructure-playbooks/recover-osds-after-ssd-journal-failure.yml b/infrastructure-playbooks/recover-osds-after-ssd-journal-failure.yml index 4c21eeec0..0cf1d94b0 100644 --- a/infrastructure-playbooks/recover-osds-after-ssd-journal-failure.yml +++ b/infrastructure-playbooks/recover-osds-after-ssd-journal-failure.yml @@ -56,6 +56,12 @@ dev_ssds: [] tasks: + - name: get the name of the existing ceph cluster + shell: | + basename $(grep -R fsid /etc/ceph/ | egrep -o '^[^.]*') + changed_when: false + register: cluster_name + - name: get osd(s) if directory stat stat: path: "/var/lib/ceph/osd/ceph-{{ item.1.osd_id }}/journal_uuid" @@ -105,10 +111,10 @@ - name: reinitialize osd(s) journal in new ssd shell: > - ceph-osd -i {{ item.item[1].osd_id }} --mkjournal + ceph-osd -i {{ item.item[1].osd_id }} --mkjournal --cluster {{ cluster_name.stdout }} with_items: - "{{ osds_uuid.results }}" - when: dev_ssds is defined + when: dev_ssds is defined and cluster_name is defined - name: start osd(s) service service: