ceph-ansible/roles/ceph-osd/tasks/activate_osds.yml

37 lines
1.4 KiB
YAML
Raw Normal View History

2014-09-05 03:14:11 +08:00
---
# NOTE (leseb) : this task is for disk devices only because of the explicit use of the first
2014-09-05 03:14:11 +08:00
# partition.
- name: activate osd(s) when device is a disk
command: ceph-disk activate "{{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\1p') | regex_replace('^(\/dev\/loop[0-9]{1})$', '\1p') }}1"
with_items:
- "{{ devices|unique }}"
changed_when: false
register: activate_osd_disk
when:
- not osd_auto_discovery
- not dmcrypt
- name: activate osd(s) when device is a disk (dmcrypt)
command: ceph-disk activate --dmcrypt "{{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\1p') | regex_replace('^(\/dev\/loop[0-9]{1})$', '\1p') }}1"
with_items:
- "{{ devices|unique }}"
changed_when: false
register: activate_osd_disk_dmcrypt
when:
- not osd_auto_discovery
- dmcrypt
# NOTE (leseb): we must do this because of
# https://github.com/ansible/ansible/issues/4297
- name: set_fact combined_activate_osd_disk_results
set_fact:
combined_activate_osd_disk_results: "{{ activate_osd_disk if osd_scenario != 'collocated' else activate_osd_disk_dmcrypt }}"
2014-09-05 03:14:11 +08:00
- 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([]) }}"