2016-08-10 06:57:41 +08:00
|
|
|
---
|
|
|
|
- name: check the partition status of the osd disks
|
2017-09-13 05:31:19 +08:00
|
|
|
command: "parted --script {{ item }} print"
|
|
|
|
with_items:
|
2016-11-30 18:00:39 +08:00
|
|
|
- "{{ devices }}"
|
2016-08-10 06:57:41 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-08-17 05:49:30 +08:00
|
|
|
register: osd_partition_status_results
|
2017-10-12 21:29:41 +08:00
|
|
|
tags:
|
|
|
|
- always
|
2016-08-10 06:57:41 +08:00
|
|
|
|
|
|
|
# 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:
|
2016-08-17 05:49:30 +08:00
|
|
|
- "{{ osd_partition_status_results.results }}"
|
|
|
|
- "{{ devices }}"
|
2016-08-10 06:57:41 +08:00
|
|
|
changed_when: false
|
2016-11-30 18:00:39 +08:00
|
|
|
when:
|
|
|
|
- not item.0.get("skipped")
|
|
|
|
- item.0.get("rc", 0) != 0
|
2017-07-25 23:54:26 +08:00
|
|
|
- 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
|