2015-01-09 01:27:43 +08:00
|
|
|
---
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: get osd path
|
2015-01-09 01:27:43 +08:00
|
|
|
shell: "df | grep {{ item }} | awk '{print $6}'"
|
|
|
|
with_items: devices
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-29 00:21:15 +08:00
|
|
|
failed_when: false
|
2015-06-26 06:26:03 +08:00
|
|
|
register: osd_path
|
2016-03-08 07:40:50 +08:00
|
|
|
when: not osd_directory
|
2015-01-09 01:27:43 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: get osd id
|
2015-01-09 01:27:43 +08:00
|
|
|
command: cat {{ item.stdout }}/whoami
|
|
|
|
with_items: osd_path.results
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-07-29 00:21:15 +08:00
|
|
|
failed_when: false
|
2016-03-08 07:40:50 +08:00
|
|
|
register: osd_id_non_dir_scenario
|
|
|
|
when: not osd_directory
|
|
|
|
|
|
|
|
- name: get osd id for directory scenario
|
|
|
|
command: cat {{ item.stdout }}/whoami
|
|
|
|
with_items: osd_directories
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
register: osd_id_dir_scenario
|
|
|
|
when: osd_directory
|
|
|
|
|
|
|
|
# NOTE (leseb): we must do this because of
|
|
|
|
# https://github.com/ansible/ansible/issues/4297
|
|
|
|
- name: combine osd_path results
|
|
|
|
set_fact:
|
|
|
|
combined_osd_id: "{{ osd_id_non_dir_scenario if not osd_directory else osd_id_dir_scenario }}"
|
2015-01-09 01:27:43 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: create a ceph fragment and assemble directory
|
2015-10-19 09:24:47 +08:00
|
|
|
file:
|
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2016-03-08 21:32:32 +08:00
|
|
|
owner: "{{ dir_owner }}"
|
|
|
|
group: "{{ dir_group }}"
|
|
|
|
mode: "{{ dir_mode }}"
|
2015-01-09 01:27:43 +08:00
|
|
|
with_items:
|
|
|
|
- /etc/ceph/ceph.d/
|
|
|
|
- /etc/ceph/ceph.d/osd_fragments
|
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: create the osd fragment
|
2015-10-19 09:24:47 +08:00
|
|
|
template:
|
|
|
|
src: osd.conf.j2
|
|
|
|
dest: /etc/ceph/ceph.d/osd_fragments/osd.{{ item.stdout }}.conf
|
2016-03-08 21:32:32 +08:00
|
|
|
owner: "{{ dir_owner }}"
|
|
|
|
group: "{{ dir_group }}"
|
|
|
|
mode: "{{ activate_file_mode }}"
|
2016-03-08 07:40:50 +08:00
|
|
|
with_items: combined_osd_id.results
|
2015-01-09 01:27:43 +08:00
|
|
|
|
2016-03-29 21:37:31 +08:00
|
|
|
- name: copy {{ cluster }}.conf for assembling
|
|
|
|
command: cp /etc/ceph/{{ cluster }}.conf /etc/ceph/ceph.d/
|
2015-06-26 06:26:03 +08:00
|
|
|
changed_when: false
|
2015-01-09 01:27:43 +08:00
|
|
|
|
2015-07-24 02:01:43 +08:00
|
|
|
- name: assemble osd sections
|
2015-10-19 09:24:47 +08:00
|
|
|
assemble:
|
|
|
|
src: /etc/ceph/ceph.d/osd_fragments/
|
|
|
|
dest: /etc/ceph/ceph.d/osd.conf
|
2016-03-08 21:32:32 +08:00
|
|
|
owner: "{{ dir_owner }}"
|
|
|
|
group: "{{ dir_group }}"
|
|
|
|
mode: "{{ activate_file_mode }}"
|
2015-01-09 01:27:43 +08:00
|
|
|
|
2016-03-29 21:37:31 +08:00
|
|
|
- name: assemble {{ cluster }}.conf and osd fragments
|
2015-10-19 09:24:47 +08:00
|
|
|
assemble:
|
|
|
|
src: /etc/ceph/ceph.d/
|
2016-03-29 21:37:31 +08:00
|
|
|
dest: /etc/ceph/{{ cluster }}.conf
|
2016-03-08 21:32:32 +08:00
|
|
|
owner: "{{ dir_owner }}"
|
|
|
|
group: "{{ dir_group }}"
|
|
|
|
mode: "{{ activate_file_mode }}"
|