with_dict: ansible_devices
changed_when: false
failed_when: false
- register: ispartition
+ register: ispartition_autodiscover
when:
ansible_devices is defined and
item.value.removable == "0" and
osd_auto_discovery
+# NOTE (leseb): we must do this because of
+# https://github.com/ansible/ansible/issues/4297
+- name: combine ispartition results
+ set_fact:
+ combined_ispartition_results: "{{ ispartition if not osd_auto_discovery else ispartition_autodiscover }}"
+
- name: check the partition status of the osd disks
shell: "parted --script {{ item }} print > /dev/null 2>&1"
with_items: devices
register: osd_partition_status
when:
journal_collocation or
- raw_multi_journal and
- not osd_auto_discovery
+ 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
+ register: osd_partition_status_autodiscover
when:
journal_collocation or
raw_multi_journal and
item.value.partitions|count == 0 and
osd_auto_discovery
+# NOTE (leseb): we must do this because of
+# https://github.com/ansible/ansible/issues/4297
+- name: combine osd_partition_status results
+ set_fact:
+ combined_osd_partition_status_results: "{{ osd_partition_status if not osd_auto_discovery else osd_partition_status_autodiscover }}"
+
- name: check the partition status of the journal devices
shell: "parted --script {{ item }} print > /dev/null 2>&1"
with_items: raw_journal_devices
- name: fix partitions gpt header or labels of the osd disks
shell: sgdisk --zap-all --clear --mbrtogpt -g -- {{ item.1 }}
with_together:
- - osd_partition_status.results
+ - combined_osd_partition_status_results.results
- devices
changed_when: false
when:
- 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
+ - combined_osd_partition_status_results.results
- ansible_devices
changed_when: false
when:
when: not osd_auto_discovery
- name: check if a partition named 'ceph' exists (autodiscover disks)
- shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
+ shell: "parted --script /dev/{{ item }} print | egrep -sq '^ 1.*ceph'"
with_dict: ansible_devices
changed_when: false
failed_when: false
- register: parted
+ register: parted_autodiscover
when:
ansible_devices is defined and
item.value.removable == "0" and
+ item.value.partitions|count != 0 and
osd_auto_discovery
+
+# NOTE (leseb): we must do this because of
+# https://github.com/ansible/ansible/issues/4297
+- name: combine parted results
+ set_fact:
+ combined_parted_results: "{{ parted if not osd_auto_discovery else parted_autodiscover }}"