From fd6c9f3882074137ad4db74d8785afefa5684c4f Mon Sep 17 00:00:00 2001
From: chenxing <chason.chan@foxmail.com>
Date: Tue, 20 Mar 2018 10:52:44 +0800
Subject: [PATCH] Enable ceph dashboard by default

Co-Authored-By: rhcayadav <rhcayadav@gmail.com>

Change-Id: I3c2c56decbb9de86101f45592ba8135c49c49405
Closes-Bug: #1754424
---
 ansible/group_vars/all.yml                                   | 1 +
 ansible/roles/ceph/tasks/deploy.yml                          | 5 +++++
 ansible/roles/ceph/tasks/start_ceph_dashboard.yml            | 5 +++++
 etc/kolla/globals.yml                                        | 1 +
 .../notes/support-ceph-dashboard-3ee5e489ea16ea25.yaml       | 5 +++++
 5 files changed, 17 insertions(+)
 create mode 100644 ansible/roles/ceph/tasks/start_ceph_dashboard.yml
 create mode 100644 releasenotes/notes/support-ceph-dashboard-3ee5e489ea16ea25.yaml

diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 63fc13a989..eedeb11293 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -412,6 +412,7 @@ enable_ceph: "no"
 enable_ceph_mds: "no"
 enable_ceph_rgw: "no"
 enable_ceph_nfs: "no"
+enable_ceph_dashboard: "{{ enable_ceph | bool }}"
 enable_chrony: "no"
 enable_cinder: "no"
 enable_cinder_backup: "yes"
diff --git a/ansible/roles/ceph/tasks/deploy.yml b/ansible/roles/ceph/tasks/deploy.yml
index 286ca26f5c..de8f8e3e61 100644
--- a/ansible/roles/ceph/tasks/deploy.yml
+++ b/ansible/roles/ceph/tasks/deploy.yml
@@ -12,6 +12,11 @@
 - include: start_mgrs.yml
   when: inventory_hostname in groups['ceph-mgr']
 
+- include: start_ceph_dashboard.yml
+  when:
+    - enable_ceph_dashboard | bool
+    - inventory_hostname in groups['ceph-mon']
+
 - include: start_nfss.yml
   when:
     - enable_ceph_nfs | bool
diff --git a/ansible/roles/ceph/tasks/start_ceph_dashboard.yml b/ansible/roles/ceph/tasks/start_ceph_dashboard.yml
new file mode 100644
index 0000000000..19885d98be
--- /dev/null
+++ b/ansible/roles/ceph/tasks/start_ceph_dashboard.yml
@@ -0,0 +1,5 @@
+---
+- name: Enable ceph dashboard
+  command: docker exec ceph_mon ceph mgr module enable dashboard
+  changed_when: false
+  run_once: true
diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml
index 0b296d8e12..aaa349e059 100644
--- a/etc/kolla/globals.yml
+++ b/etc/kolla/globals.yml
@@ -149,6 +149,7 @@ kolla_internal_vip_address: "10.10.10.254"
 #enable_ceph_mds: "no"
 #enable_ceph_rgw: "no"
 #enable_ceph_nfs: "no"
+#enable_ceph_dashboard: "{{ enable_ceph | bool }}"
 #enable_chrony: "no"
 #enable_cinder: "no"
 #enable_cinder_backup: "yes"
diff --git a/releasenotes/notes/support-ceph-dashboard-3ee5e489ea16ea25.yaml b/releasenotes/notes/support-ceph-dashboard-3ee5e489ea16ea25.yaml
new file mode 100644
index 0000000000..7a3aea6332
--- /dev/null
+++ b/releasenotes/notes/support-ceph-dashboard-3ee5e489ea16ea25.yaml
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    Add support for ceph-dashboard. It enables 'dashboard' module in ceph cluster.
+    Its uses command 'ceph mgr module enable dashboard'.