From: Sébastien Han Date: Thu, 6 Mar 2014 10:12:25 +0000 (+0100) Subject: Support diverse setup disks X-Git-Tag: v1.0.0~402^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F4%2Fhead;p=ceph-ansible.git Support diverse setup disks This brings the support of heterogeneous hardware. Not all the servers are identical, some have more or less disks than the others. Prior this commit, the 'parted' command was hanging, now the command simply exits 1 if the device doesn't exist, same for the 'egrep' piped command after. Then we skip these errors and continue to run. So now, you can specify multiple devices in group_vars/osds that don't exist on all the servers. Signed-off-by: Sébastien Han --- diff --git a/group_vars/osds b/group_vars/osds index 934bb6a9c..10f5f7dbe 100644 --- a/group_vars/osds +++ b/group_vars/osds @@ -3,6 +3,10 @@ # # Devices to be used as OSDs +# You can pre-provision disks that are not present yet. +# Ansible will just skip them. Newly added disk will be +# automatically configured during the next run. +# devices: - /dev/sdc - /dev/sdd diff --git a/roles/osd/tasks/main.yml b/roles/osd/tasks/main.yml index 68ac4c7eb..caa0d63d3 100644 --- a/roles/osd/tasks/main.yml +++ b/roles/osd/tasks/main.yml @@ -21,7 +21,7 @@ # - name: If partition named 'ceph' exists - shell: parted {{ item }} print | egrep -sq '^ 1.*ceph' + shell: parted --script {{ item }} print | egrep -sq '^ 1.*ceph' ignore_errors: True with_items: devices register: parted @@ -43,6 +43,7 @@ - name: Prepare OSD disk(s) command: ceph-disk prepare {{ item.1 }} {{ journal_device }} when: item.0.rc != 0 + ignore_errors: True with_together: - parted.results - devices @@ -56,6 +57,7 @@ - name: Activate OSD(s) command: ceph-disk activate {{ item }}1 + ignore_errors: True with_items: devices changed_when: False