---
- name: Ensuring config directories exist
  file:
    path: "{{ node_config_directory }}/{{ item }}"
    state: "directory"
    recurse: yes
  with_items:
    - "ceph-mon"
    - "ceph-osd"
    - "ceph-rgw"

- name: Copying over config.json files for services
  template:
    src: "{{ item }}.json.j2"
    dest: "{{ node_config_directory }}/{{ item }}/config.json"
  with_items:
    - "ceph-mon"
    - "ceph-osd"
    - "ceph-rgw"

- name: Copying over ceph.conf
  vars:
    service_name: "{{ item }}"
  merge_configs:
    sources:
      - "{{ role_path }}/templates/ceph.conf.j2"
      - "{{ node_custom_config }}/ceph.conf"
      - "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf"
    dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
  with_items:
    - "ceph-mon"
    - "ceph-osd"
    - "ceph-rgw"

---
- name: Ensuring config directories exist
  file:
    path: "{{ node_config_directory }}/{{ item }}"
    state: "directory"
    recurse: yes
  with_items:
    - "ceph-mon"
    - "ceph-osd"
    - "ceph-rgw"

- name: Copying over config.json files for services
  template:
    src: "{{ item.name }}.json.j2"
    dest: "{{ node_config_directory }}/{{ item.name }}/config.json"
  when:
    - inventory_hostname in groups[item.group]
  with_items:
    - name: "ceph-mon"
      group: ceph-mon
    - name: "ceph-osd"
      group: ceph-osd
    - name: "ceph-rgw"
      group: ceph-rgw

- name: Copying over ceph.conf
  vars:
    service_name: "{{ item }}"
  merge_configs:
    sources:
      - "{{ role_path }}/templates/ceph.conf.j2"
      - "{{ node_custom_config }}/ceph.conf"
      - "{{ node_custom_config }}/ceph/{{ inventory_hostname }}/ceph.conf"
    dest: "{{ node_config_directory }}/{{ item }}/ceph.conf"
  with_items:
    - "ceph-mon"
    - "ceph-osd"
    - "ceph-rgw"

Fix deploy ceph failed when contoller hava no cluster_interface
Fix deploy ceph failed when contoller hava no cluster_interface

when ceph-mon and ceph-osd run on difference hosts
such as ceph-mon run on controller node, ceph-osd
run on storage node, and controller node have no
cluster_interface, when it happens, kolla-ansible
will failed.

Closes-Bug: #1735775 

Change-Id: I8d6bc66d41c544ab9e7e1b126127e25c70a22933
