From: WingkaiHo Date: Thu, 27 Apr 2017 02:26:26 +0000 (+0800) Subject: improve shrink-osd.yml can shrink osd when disk damage X-Git-Tag: v2.3.0rc1~36^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1476%2Fhead;p=ceph-ansible.git improve shrink-osd.yml can shrink osd when disk damage --- diff --git a/infrastructure-playbooks/shrink-osd.yml b/infrastructure-playbooks/shrink-osd.yml index e71e53178..3fc54ce78 100644 --- a/infrastructure-playbooks/shrink-osd.yml +++ b/infrastructure-playbooks/shrink-osd.yml @@ -118,14 +118,50 @@ - name: deactivating osd(s) command: ceph-disk deactivate --cluster {{ cluster }} --deactivate-by-id {{ item.0 }} --mark-out + register: deactivate + ignore_errors: yes with_together: - "{{ osd_ids.split(',') }}" - "{{ real_ips }}" delegate_to: "{{ item.1 }}" + - name: set osd(s) out when ceph-disk deactivating fail + command: ceph --cluster {{ cluster }} osd out osd.{{ item.0 }} + with_together: + - "{{ osd_ids.split(',') }}" + - "{{ deactivate.results }}" + when: + - item.1.stderr|length > 0 + - name: destroying osd(s) command: ceph-disk destroy --cluster {{ cluster }} --destroy-by-id {{ item.0 }} --zap + register: destroy + ignore_errors: yes with_together: - "{{ osd_ids.split(',') }}" - "{{ real_ips }}" delegate_to: "{{ item.1 }}" + + - name: remove osd(s) from crush_map when ceph-disk destroy fail + command: ceph --cluster {{ cluster }} osd crush remove osd.{{ item.0 }} + with_together: + - "{{ osd_ids.split(',') }}" + - "{{ destroy.results }}" + when: + - item.1.stderr|length > 0 + + - name: delete osd(s) auth key when ceph-disk destroy fail + command: ceph --cluster {{ cluster }} auth del osd.{{ item.0 }} + with_together: + - "{{ osd_ids.split(',') }}" + - "{{ destroy.results }}" + when: + - item.1.stderr|length > 0 + + - name: deallocate osd(s) id when ceph-disk destroy fail + command: ceph --cluster {{ cluster }} osd rm {{ item.0 }} + with_together: + - "{{ osd_ids.split(',') }}" + - "{{ destroy.results }}" + when: + - item.1.stderr|length > 0