---
- name: create ceph conf directory
  file:
    path: /etc/ceph
    state: directory
    owner: "ceph"
    group: "ceph"
    mode: "0755"

- name: "generate ceph configuration file: {{ cluster }}.conf"
  action: config_template
  args:
    src: ceph.conf.j2
    dest: /etc/ceph/{{ cluster }}.conf
    owner: "ceph"
    group: "ceph"
    mode: "0644"
    config_overrides: "{{ ceph_conf_overrides }}"
    config_type: ini
  notify:
    - restart ceph mons
    - restart ceph osds
    - restart ceph mdss
    - restart ceph rgws
    - restart ceph nfss

---
- name: create ceph conf directory and assemble directory
  file:
    path: "{{ item }}"
    state: directory
    owner: "ceph"
    group: "ceph"
    mode: "0755"
  with_items:
    - /etc/ceph/
    - /etc/ceph/ceph.d/

- name: "generate ceph configuration file: {{ cluster }}.conf"
  action: config_template
  args:
    src: ceph.conf.j2
    dest: /etc/ceph/ceph.d/{{ cluster }}.conf
    owner: "ceph"
    group: "ceph"
    mode: "0644"
    config_overrides: "{{ ceph_conf_overrides }}"
    config_type: ini

- name: assemble {{ cluster }}.conf and fragments
  assemble:
    src: /etc/ceph/ceph.d/
    dest: /etc/ceph/{{ cluster }}.conf
    owner: "ceph"
    group: "ceph"
    mode: "0644"
  notify:
    - restart ceph mons
    - restart ceph osds
    - restart ceph mdss
    - restart ceph rgws
    - restart ceph nfss

Make ceph-common aware off osd config fragments
Make ceph-common aware off osd config fragments

This removes the implicit order requirement when using OSD fragments.
When you use OSD fragments and ceph-osd role is not the last one,
the fragments get removed from ceph.conf by ceph-common.

It is not nice to have this code at two locations, but this is
necessary to prevent problems, when ceph-osd is the last role as
ceph-common gets executed before ceph-osd.

This could be prevented when ceph-common would be explicitly called
at the end of the playbook.

Signed-off-by: Christian Zunker <55c21f91ef088e50e9390ce29a26f69b20baf7b0@codecentric.de>
