--- - name: check the partition status of the osd disks command: "parted --script {{ item }} print" with_items: - "{{ devices }}" changed_when: false failed_when: false always_run: true register: osd_partition_status_results # 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 # of zapping the whole device so these try again. It is easier to use `||` to # keep the current flow of the task. # See: https://github.com/ceph/ceph-ansible/issues/759 - name: fix partitions gpt header or labels of the osd disks shell: "sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }} || sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }}" with_together: - "{{ osd_partition_status_results.results }}" - "{{ devices }}" changed_when: false when: - not item.0.get("skipped") - item.0.get("rc", 0) != 0 - not containerized_deployment - name: create gpt disk label command: parted --script {{ item.1 }} mklabel gpt with_together: - "{{ osd_partition_status_results.results }}" - "{{ devices }}" changed_when: false when: - not item.0.get("skipped") - item.0.get("rc", 0) != 0 - containerized_deployment - 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 always_run: true register: parted_results