mirror of https://github.com/ceph/ceph-ansible.git
ceph-osd: fix the auto discovery scenario
While this is not widly used (AFAIK :p) the feature was broken. Thanks to @zmc for reporting it. You can now set `osd_auto_discovery` to true in your group_vars/osd and it will go through all the devices available and will make them OSDs. Signed-off-by: Sébastien Han <seb@redhat.com>pull/536/head
parent
78cb5cc726
commit
ea0979cbbe
|
@ -16,6 +16,18 @@
|
|||
changed_when: false
|
||||
failed_when: false
|
||||
register: ispartition
|
||||
when: not osd_auto_discovery
|
||||
|
||||
- name: check if the device is a partition (autodiscover disks)
|
||||
shell: "echo '/dev/{{ item.key }}' | egrep '/dev/(sd[a-z]{1,2}|hd[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p)[0-9]{1,2}$'"
|
||||
with_dict: ansible_devices
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: ispartition
|
||||
when:
|
||||
ansible_devices is defined and
|
||||
item.value.removable == "0" and
|
||||
osd_auto_discovery
|
||||
|
||||
- name: check the partition status of the osd disks
|
||||
shell: "parted --script {{ item }} print > /dev/null 2>&1"
|
||||
|
@ -25,7 +37,22 @@
|
|||
register: osd_partition_status
|
||||
when:
|
||||
journal_collocation or
|
||||
raw_multi_journal
|
||||
raw_multi_journal and
|
||||
not osd_auto_discovery
|
||||
|
||||
- name: check the partition status of the osd disks (autodiscover disks)
|
||||
shell: "parted --script /dev/{{ item.key }} print > /dev/null 2>&1"
|
||||
with_dict: ansible_devices
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: osd_partition_status
|
||||
when:
|
||||
journal_collocation or
|
||||
raw_multi_journal and
|
||||
ansible_devices is defined and
|
||||
item.value.removable == "0" and
|
||||
item.value.partitions|count == 0 and
|
||||
osd_auto_discovery
|
||||
|
||||
- name: check the partition status of the journal devices
|
||||
shell: "parted --script {{ item }} print > /dev/null 2>&1"
|
||||
|
@ -41,7 +68,24 @@
|
|||
- osd_partition_status.results
|
||||
- devices
|
||||
changed_when: false
|
||||
when: (journal_collocation or raw_multi_journal) and item.0.rc != 0
|
||||
when:
|
||||
(journal_collocation or raw_multi_journal) and not
|
||||
osd_auto_discovery and
|
||||
item.0.rc != 0
|
||||
|
||||
- name: fix partitions gpt header or labels of the osd disks (autodiscover disks)
|
||||
shell: sgdisk --zap-all --clear --mbrtogpt -g -- "/dev/{{ item.1.key }}"
|
||||
with_together:
|
||||
- osd_partition_status.results
|
||||
- ansible_devices
|
||||
changed_when: false
|
||||
when:
|
||||
journal_collocation and
|
||||
osd_auto_discovery and
|
||||
ansible_devices is defined and
|
||||
item.value.removable == "0" and
|
||||
item.value.partitions|count == 0 and
|
||||
item.0.rc != 0
|
||||
|
||||
- name: fix partitions gpt header or labels of the journal devices
|
||||
shell: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item.1 }}
|
||||
|
@ -49,11 +93,25 @@
|
|||
- journal_partition_status.results
|
||||
- raw_journal_devices
|
||||
changed_when: false
|
||||
when: raw_multi_journal and item.0.rc != 0
|
||||
when:
|
||||
raw_multi_journal and
|
||||
item.0.rc != 0
|
||||
|
||||
- name: if partition named 'ceph' exists
|
||||
- name: check if a partition named 'ceph' exists
|
||||
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
|
||||
with_items: devices
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: parted
|
||||
when: not osd_auto_discovery
|
||||
|
||||
- name: check if a partition named 'ceph' exists (autodiscover disks)
|
||||
shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
|
||||
with_dict: ansible_devices
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
register: parted
|
||||
when:
|
||||
ansible_devices is defined and
|
||||
item.value.removable == "0" and
|
||||
osd_auto_discovery
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
journal_collocation and
|
||||
osd_auto_discovery
|
||||
|
||||
- name: manually Prepare osd disk(s)
|
||||
- name: manually prepare osd disk(s)
|
||||
command: "ceph-disk prepare {{ item.2 }}"
|
||||
ignore_errors: true
|
||||
with_together:
|
||||
|
|
Loading…
Reference in New Issue