2014-09-05 03:14:11 +08:00
|
|
|
---
|
2015-05-16 00:27:41 +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.
|
2016-02-25 06:09:34 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: activate osd(s) when device is a disk
|
2017-09-13 05:31:19 +08:00
|
|
|
command: ceph-disk activate {{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
|
|
|
|
with_items:
|
2016-10-10 21:16:03 +08:00
|
|
|
- "{{ devices|unique }}"
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-08-18 00:14:06 +08:00
|
|
|
failed_when: false
|
2016-04-11 22:28:03 +08:00
|
|
|
register: activate_osd_disk
|
2016-02-25 00:25:26 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- not osd_auto_discovery
|
2016-07-19 23:55:57 +08:00
|
|
|
|
|
|
|
- name: activate osd(s) when device is a disk (dmcrypt)
|
2017-09-13 05:31:19 +08:00
|
|
|
command: ceph-disk activate --dmcrypt {{ item | regex_replace('^(\/dev\/cciss\/c[0-9]{1}d[0-9]{1})$', '\\1p') }}1
|
|
|
|
with_items:
|
2016-10-10 21:16:03 +08:00
|
|
|
- "{{ devices|unique }}"
|
2016-07-19 23:55:57 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: activate_osd_disk_dmcrypt
|
|
|
|
when:
|
|
|
|
- not osd_auto_discovery
|
2017-07-27 23:05:59 +08:00
|
|
|
- dmcrypt
|
2016-07-19 23:55:57 +08:00
|
|
|
|
|
|
|
# NOTE (leseb): we must do this because of
|
|
|
|
# https://github.com/ansible/ansible/issues/4297
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact combined_activate_osd_disk_results
|
2016-07-19 23:55:57 +08:00
|
|
|
set_fact:
|
2017-07-27 23:05:59 +08:00
|
|
|
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
|
|
|
|
2016-04-11 22:28:03 +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', '') "
|
2016-10-03 22:48:04 +08:00
|
|
|
with_items: "{{ (combined_activate_osd_disk_results|default({})).results|default([]) }}"
|
2016-04-11 22:28:03 +08:00
|
|
|
|
2015-05-16 00:27:41 +08:00
|
|
|
# NOTE (leseb): this task is for partitions because we don't explicitly use a partition.
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: activate osd(s) when device is a partition
|
2017-09-13 05:31:19 +08:00
|
|
|
command: "ceph-disk activate {{ item }}"
|
|
|
|
with_items:
|
2016-10-10 21:16:03 +08:00
|
|
|
- "{{ devices|unique }}"
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-29 00:21:15 +08:00
|
|
|
failed_when: false
|
2016-02-25 00:25:26 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- not osd_auto_discovery
|