From: Shengjing Zhu Date: Mon, 20 Feb 2017 08:35:56 +0000 (+0800) Subject: fix grep match pattern for osd ids X-Git-Tag: v2.2.0rc1~26^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=32923fd217cd92fd3541535ad8916f0ae261c9e8;p=ceph-ansible.git fix grep match pattern for osd ids Some playbooks use [0-9]*, others use \d+$ The latter is more correct since cluster name may contain numbers. Signed-off-by: Shengjing Zhu --- diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index f27925834..8bd1471eb 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -234,7 +234,7 @@ - name: stop ceph osds on ubuntu shell: | - for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do + for id in $(ls /var/lib/ceph/osd/ |grep -oP '\d+$'); do initctl stop ceph-osd cluster={{ cluster }} id=$id done failed_when: false diff --git a/roles/ceph-common/handlers/restart-osd.yml b/roles/ceph-common/handlers/restart-osd.yml index dc6fbeebb..ad2fd4ffc 100644 --- a/roles/ceph-common/handlers/restart-osd.yml +++ b/roles/ceph-common/handlers/restart-osd.yml @@ -4,7 +4,7 @@ # for restarting them specifically. - name: restart ceph osds shell: | - for id in $(ls /var/lib/ceph/osd/ |grep -oh '[0-9]*'); do + for id in $(ls /var/lib/ceph/osd/ |grep -oP '\d+$'); do systemctl restart ceph-osd@$id sleep 5 done diff --git a/roles/ceph-common/handlers/validate-osd.yml b/roles/ceph-common/handlers/validate-osd.yml index 99d1c2f87..88881212c 100644 --- a/roles/ceph-common/handlers/validate-osd.yml +++ b/roles/ceph-common/handlers/validate-osd.yml @@ -1,7 +1,7 @@ --- - name: collect osds shell: | - ls /var/lib/ceph/osd/ |grep -oh '[0-9]*' + ls /var/lib/ceph/osd/ |grep -oP '\d+$' register: osd_ids - name: wait for ceph osd socket(s)