mirror of https://github.com/ceph/ceph-ansible.git
57 lines
1.9 KiB
YAML
57 lines
1.9 KiB
YAML
---
|
|
# NOTE (leseb) : this task is for disk devices only because of the explicit use of the first
|
|
# partition.
|
|
|
|
- name: activate osd(s) when device is a disk
|
|
command: ceph-disk activate {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
|
|
with_together:
|
|
- "{{ ispartition_results.results }}"
|
|
- "{{ devices|unique }}"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: activate_osd_disk
|
|
when:
|
|
- not item.0.get("skipped")
|
|
- item.0.get("rc", 0) != "0"
|
|
- not osd_auto_discovery
|
|
|
|
- name: activate osd(s) when device is a disk (dmcrypt)
|
|
command: ceph-disk activate --dmcrypt {{ item.1 | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
|
|
with_together:
|
|
- "{{ ispartition_results.results }}"
|
|
- "{{ devices|unique }}"
|
|
changed_when: false
|
|
failed_when: false
|
|
register: activate_osd_disk_dmcrypt
|
|
when:
|
|
- not item.0.get("skipped")
|
|
- item.0.get("rc", 0) != "0"
|
|
- not osd_auto_discovery
|
|
- dmcrypt
|
|
|
|
# NOTE (leseb): we must do this because of
|
|
# https://github.com/ansible/ansible/issues/4297
|
|
- name: combine ispartition results
|
|
set_fact:
|
|
combined_activate_osd_disk_results: "{{ activate_osd_disk if osd_scenario != 'collocated' else activate_osd_disk_dmcrypt }}"
|
|
|
|
- name: fail if ceph-disk cannot create an OSD
|
|
fail:
|
|
msg: "ceph-disk failed to create an OSD"
|
|
when:
|
|
" 'ceph-disk: Error: ceph osd create failed' in item.get('stderr', '') "
|
|
with_items: "{{ (combined_activate_osd_disk_results|default({})).results|default([]) }}"
|
|
|
|
# NOTE (leseb): this task is for partitions because we don't explicitly use a partition.
|
|
- name: activate osd(s) when device is a partition
|
|
command: "ceph-disk activate {{ item.1 }}"
|
|
with_together:
|
|
- "{{ ispartition_results.results }}"
|
|
- "{{ devices|unique }}"
|
|
changed_when: false
|
|
failed_when: false
|
|
when:
|
|
- not item.0.get("skipped")
|
|
- item.0.get("rc", 0) == "0"
|
|
- not osd_auto_discovery
|