2014-09-05 03:14:11 +08:00
|
|
|
---
|
|
|
|
# NOTE (leseb): current behavior of ceph-disk is to fail when the device is mounted "stderr: ceph-disk: Error: Device is mounted: /dev/sdb1"
|
|
|
|
# the return code is 1, which makes sense, however ideally if ceph-disk will detect a ceph partition
|
|
|
|
# it should exist we rc=0 and don't do anything unless we do something like --force
|
2015-07-29 00:21:15 +08:00
|
|
|
# As as a final word, I prefer to keep the partition check instead of running ceph-disk prepare with "failed_when: false"
|
2014-09-05 03:14:11 +08:00
|
|
|
# I believe it's safer
|
2015-10-09 18:40:57 +08:00
|
|
|
#
|
|
|
|
# regex syntax uses (pat1|pat2|...|patN) for different families of device
|
|
|
|
# names, but has a common expression for partition number at the end.
|
|
|
|
# allow 2-digit partition numbers so fast SSDs can be shared by > 9 disks
|
|
|
|
# for SSD journals.
|
|
|
|
|
2017-09-28 06:17:12 +08:00
|
|
|
- name: resolve dedicated device link(s)
|
|
|
|
command: readlink -f {{ item }}
|
|
|
|
changed_when: false
|
|
|
|
with_items: "{{ dedicated_devices }}"
|
|
|
|
register: dedicated_devices_prepare_canonicalize
|
|
|
|
when:
|
|
|
|
- osd_scenario == 'non-collocated'
|
|
|
|
|
|
|
|
- name: set_fact build dedicated_devices from resolved symlinks
|
|
|
|
set_fact:
|
2017-10-06 20:35:42 +08:00
|
|
|
dedicated_devices_tmp: "{{ dedicated_devices_tmp | default([]) + [ item.stdout ] }}"
|
2017-09-28 06:17:12 +08:00
|
|
|
with_items: "{{ dedicated_devices_prepare_canonicalize.results }}"
|
|
|
|
when:
|
|
|
|
- osd_scenario == 'non-collocated'
|
|
|
|
|
|
|
|
- name: set_fact build final dedicated_devices list
|
|
|
|
set_fact:
|
2017-10-06 20:35:42 +08:00
|
|
|
dedicated_devices: "{{ dedicated_devices_tmp | reject('search','/dev/disk') | list }}"
|
2017-09-28 06:17:12 +08:00
|
|
|
when:
|
|
|
|
- osd_scenario == 'non-collocated'
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: include check_devices_static.yml
|
|
|
|
include: check_devices_static.yml
|
2016-08-17 05:49:30 +08:00
|
|
|
# Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent)
|
|
|
|
static: False
|
2016-02-12 07:54:09 +08:00
|
|
|
|
2015-11-20 23:05:30 +08:00
|
|
|
- name: check the partition status of the journal devices
|
2017-09-13 05:31:19 +08:00
|
|
|
command: "parted --script {{ item }} print"
|
|
|
|
with_items:
|
2017-07-27 23:05:59 +08:00
|
|
|
- "{{ dedicated_devices|unique }}"
|
2015-11-20 23:05:30 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
2016-11-27 05:16:07 +08:00
|
|
|
always_run: true
|
2015-11-20 23:05:30 +08:00
|
|
|
register: journal_partition_status
|
2016-11-30 18:00:39 +08:00
|
|
|
when:
|
2017-07-25 23:54:26 +08:00
|
|
|
- osd_scenario == 'non-collocated'
|
2015-11-20 23:05:30 +08:00
|
|
|
|
2017-07-25 23:54:26 +08:00
|
|
|
- name: fix partitions gpt header or labels of the journal device(s)
|
2016-07-26 08:55:43 +08:00
|
|
|
shell: "sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }} || sgdisk --zap-all --clear --mbrtogpt -- {{ item.1 }}"
|
2015-11-20 23:05:30 +08:00
|
|
|
with_together:
|
2016-08-17 05:49:30 +08:00
|
|
|
- "{{ journal_partition_status.results }}"
|
2017-07-27 23:05:59 +08:00
|
|
|
- "{{ dedicated_devices|unique }}"
|
2015-11-20 23:05:30 +08:00
|
|
|
changed_when: false
|
2016-02-12 05:40:59 +08:00
|
|
|
when:
|
2017-09-28 06:17:12 +08:00
|
|
|
- not containerized_deployment
|
|
|
|
- osd_scenario == 'non-collocated'
|
2016-11-30 18:00:39 +08:00
|
|
|
- not item.0.get("skipped")
|
2017-07-25 23:54:26 +08:00
|
|
|
- item.0.get("rc", 0) != 0
|
|
|
|
|
|
|
|
- name: create gpt disk label of the journal device(s)
|
|
|
|
command: parted --script {{ item.1 }} mklabel gpt
|
|
|
|
with_together:
|
2017-09-13 05:31:19 +08:00
|
|
|
- "{{ journal_partition_status.results }}"
|
2017-07-25 23:54:26 +08:00
|
|
|
- "{{ dedicated_devices|unique }}"
|
|
|
|
changed_when: false
|
|
|
|
when:
|
2017-09-28 06:17:12 +08:00
|
|
|
- containerized_deployment
|
|
|
|
- osd_scenario == 'non-collocated'
|
2017-07-25 23:54:26 +08:00
|
|
|
- not item.0.get("skipped")
|
2016-11-30 18:00:39 +08:00
|
|
|
- item.0.get("rc", 0) != 0
|