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

64 lines
1.5 KiB
YAML
Raw Normal View History

---
- name: get osd path
shell: "df | grep {{ item }} | awk '{print $6}'"
with_items: "{{ devices }}"
changed_when: false
failed_when: false
check_mode: no
register: osd_path
- name: get osd id
command: cat {{ item.stdout }}/whoami
with_items: "{{ osd_path.results }}"
changed_when: false
failed_when: false
check_mode: no
register: osd_id_non_dir_scenario
# NOTE (leseb): we must do this because of
# https://github.com/ansible/ansible/issues/4297
- name: set_fact combined_osd_id
set_fact:
combined_osd_id: "{{ osd_id_non_dir_scenario }}"
- name: create a ceph fragment and assemble directory
2015-10-19 09:24:47 +08:00
file:
path: "{{ item }}"
state: directory
owner: "ceph"
group: "ceph"
mode: "0755"
with_items:
- /etc/ceph/ceph.d/
- /etc/ceph/ceph.d/osd_fragments
- 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
owner: "ceph"
group: "ceph"
mode: "0644"
with_items: "{{ combined_osd_id.results }}"
- name: copy {{ cluster }}.conf for assembling
command: cp /etc/ceph/{{ cluster }}.conf /etc/ceph/ceph.d/
changed_when: false
- 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
owner: "ceph"
group: "ceph"
mode: "0644"
- name: assemble {{ cluster }}.conf and osd fragments
2015-10-19 09:24:47 +08:00
assemble:
src: /etc/ceph/ceph.d/
dest: /etc/ceph/{{ cluster }}.conf
regexp: "^(({{cluster}})|(osd)).conf$"
owner: "ceph"
group: "ceph"
mode: "0644"