---
- name: check the partition status of the osd disks
  command: "parted --script {{ item }} print"
  with_items:
    - "{{ devices }}"
  changed_when: false
  failed_when: false
  check_mode: no
  register: osd_partition_status_results

- 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

---
- name: check the partition status of the osd disks
  command: "parted --script {{ item }} print"
  with_items:
    - "{{ devices }}"
  changed_when: false
  failed_when: false
  check_mode: no
  register: osd_partition_status_results

- name: create gpt disk label
  parted:
    device: "{{ item.1 }}"
    label: gpt
  with_together:
    - "{{ osd_partition_status_results.results }}"
    - "{{ devices }}"
  changed_when: false
  when:
    - not item.0.get("skipped")
    - item.0.get("rc", 0) != 0

Use parted module instead of command
Use parted module instead of command

(cherry picked from commit 4f1e854c79d0aa3635f35441f84e126a185f21fa)
Signed-off-by: Sébastien Han <62d754cc350e84d3b1c32ae79f976f5348e74a40@redhat.com>
