# Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent)
static: False
+- name: check the journal device is partition
+ shell: "readlink -f {{ item }} | egrep '/dev/([hsv]d[a-z]{1,2}|cciss/c[0-9]d[0-9]p|nvme[0-9]n[0-9]p)[0-9]{1,2}$'"
+ with_items: "{{ raw_journal_devices }}"
+ changed_when: false
+ failed_when: false
+ always_run: true
+ register: journal_ispartition_results
+
- name: check the partition status of the journal devices
- shell: "parted --script {{ item }} print > /dev/null 2>&1"
- with_items: "{{ raw_journal_devices|unique }}"
+ shell: "parted --script {{ item.1 }} print > /dev/null 2>&1"
+ with_together:
+ - "{{ journal_ispartition_results.results }}"
+ - "{{ raw_journal_devices|unique }}"
changed_when: false
failed_when: false
always_run: true
register: journal_partition_status
- when: raw_multi_journal or dmcrypt_dedicated_journal
+ when:
+ - (raw_multi_journal or dmcrypt_dedicated_journal)
+ - item.0.rc != 0
- name: fix partitions gpt header or labels of the journal devices
shell: "sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }} || sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }}"
- "{{ raw_journal_devices|unique }}"
changed_when: false
when:
- - raw_multi_journal or dmcrypt_dedicated_journal
- - item.0.rc != 0
+ - (raw_multi_journal or dmcrypt_dedicated_journal)
+ - not item.0.get("skipped")
+ - item.0.get("rc", 0) != 0
register: ispartition_results
- name: check the partition status of the osd disks
- shell: "parted --script {{ item }} print > /dev/null 2>&1"
- with_items: "{{ devices }}"
+ shell: "parted --script {{ item.1 }} print > /dev/null 2>&1"
+ with_together:
+ - "{{ ispartition_results.results }}"
+ - "{{ devices }}"
changed_when: false
failed_when: false
always_run: true
register: osd_partition_status_results
+ when: item.0.rc != 0
# NOTE: The following calls to sgdisk are retried because sgdisk is known to
# fully wipe a device the first time around. There is no need to halt execution
- "{{ osd_partition_status_results.results }}"
- "{{ devices }}"
changed_when: false
- when: item.0.rc != 0
+ when:
+ - not item.0.get("skipped")
+ - item.0.get("rc", 0) != 0
- name: check if a partition named 'ceph' exists
- shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
- with_items: "{{ devices }}"
+ shell: "parted --script {{ item.1 }} print | egrep -sq '^ 1.*ceph'"
+ with_together:
+ - "{{ ispartition_results.results }}"
+ - "{{ devices }}"
changed_when: false
failed_when: false
always_run: true
register: parted_results
+ when: item.0.rc != 0
# if you have 64 disks with 4TB each, this will take a while
# since Ansible will sequential process the loop
-# NOTE (alahouze): if the device is a partition, the parted command below has
-# failed, this is why we check if the device is a partition too.
- name: prepare osd disk(s)
- command: "ceph-disk prepare --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}"
+ command: "ceph-disk prepare --cluster {{ cluster }} {{ item.1 }} {{ item.2 }}"
with_together:
- "{{ parted_results.results }}"
- - "{{ ispartition_results.results }}"
- "{{ devices }}"
- "{{ raw_journal_devices }}"
changed_when: false
when:
- - not item.0.get("skipped")
- - not item.1.get("skipped")
- - item.0.get("rc", 0) != 0
- - item.1.get("rc", 0) != 0
+ - item.0.get("skipped") or item.0.get("rc", 0) != 0
- raw_multi_journal
- not osd_auto_discovery