From e984cae192284bec32026e66699ce7ccd76df164 Mon Sep 17 00:00:00 2001
From: Doug Szumski <doug@stackhpc.com>
Date: Tue, 20 Feb 2018 12:07:20 +0000
Subject: [PATCH] Add kolla_enable_monasca flag

This flag enables integration with Monasca. Currently it relies
on an out-of-band Monasca installation. In the future, it is
envisaged that Kolla will support deploying Monasca.
---
 ansible/group_vars/all/kolla                      | 3 +++
 ansible/overcloud-grafana-configure.yml           | 3 +++
 ansible/roles/kolla-ansible/defaults/main.yml     | 1 +
 ansible/roles/kolla-ansible/tests/test-extras.yml | 1 +
 ansible/roles/kolla-openstack/defaults/main.yml   | 9 +++++++++
 etc/kayobe/kolla.yml                              | 1 +
 6 files changed, 18 insertions(+)

diff --git a/ansible/group_vars/all/kolla b/ansible/group_vars/all/kolla
index 3e68b13a..f9fa9394 100644
--- a/ansible/group_vars/all/kolla
+++ b/ansible/group_vars/all/kolla
@@ -295,6 +295,9 @@ kolla_enable_ironic: "yes"
 kolla_enable_kibana: "{{ 'yes' if kolla_enable_central_logging | bool else 'no' }}"
 kolla_enable_magnum: "no"
 kolla_enable_manila: "no"
+# Support for Monasca in Kolla is a work in progress. This currently relies
+# on an out-of-band Monasca installation.
+kolla_enable_monasca: "no"
 kolla_enable_murano: "no"
 kolla_enable_neutron: "yes"
 kolla_enable_nova: "yes"
diff --git a/ansible/overcloud-grafana-configure.yml b/ansible/overcloud-grafana-configure.yml
index 0f6ea6e0..38c5d432 100644
--- a/ansible/overcloud-grafana-configure.yml
+++ b/ansible/overcloud-grafana-configure.yml
@@ -18,6 +18,7 @@
   roles:
     - role: stackhpc.os-openstackclient
       os_openstackclient_venv: "{{ venv }}"
+      when: kolla_enable_monasca
 
   tasks:
     - name: Look up Monasca control plane project ID
@@ -27,10 +28,12 @@
       register: monasca_project_show
       changed_when: False
       environment: "{{ openstack_auth_env }}"
+      when: kolla_enable_monasca
 
     - name: Set Monasca control plane ID
       set_fact:
         monasca_control_plane_project_id:  "{{ (monasca_project_show.stdout | from_json).get('id') }}"
+      when: kolla_enable_monasca
 
 - name: Configure control plane monitoring for Grafana
   # Only required to run on a single host.
diff --git a/ansible/roles/kolla-ansible/defaults/main.yml b/ansible/roles/kolla-ansible/defaults/main.yml
index 88a67a89..f0db8379 100644
--- a/ansible/roles/kolla-ansible/defaults/main.yml
+++ b/ansible/roles/kolla-ansible/defaults/main.yml
@@ -207,6 +207,7 @@ kolla_openstack_logging_debug:
 #kolla_enable_magnum:
 #kolla_enable_manila:
 #kolla_enable_mistral:
+#kolla_enable_monasca:
 #kolla_enable_mongodb:
 #kolla_enable_murano:
 #kolla_enable_multipathd:
diff --git a/ansible/roles/kolla-ansible/tests/test-extras.yml b/ansible/roles/kolla-ansible/tests/test-extras.yml
index 5dedb105..e1f378ae 100644
--- a/ansible/roles/kolla-ansible/tests/test-extras.yml
+++ b/ansible/roles/kolla-ansible/tests/test-extras.yml
@@ -93,6 +93,7 @@
             kolla_enable_manila_backend_generic: True
             kolla_enable_manila_backend_hnas: True
             kolla_enable_mistral: True
+            kolla_enable_monasca: True
             kolla_enable_mongodb: True
             kolla_enable_murano: True
             kolla_enable_multipathd: True
diff --git a/ansible/roles/kolla-openstack/defaults/main.yml b/ansible/roles/kolla-openstack/defaults/main.yml
index 2b3a9909..2a305999 100644
--- a/ansible/roles/kolla-openstack/defaults/main.yml
+++ b/ansible/roles/kolla-openstack/defaults/main.yml
@@ -237,6 +237,15 @@ kolla_enable_magnum:
 # Free form extra configuration to append to magnum.conf.
 kolla_extra_magnum:
 
+###############################################################################
+# Monasca configuration.
+
+# NOTE: Support for Monasca in Kolla is a work in progress. This currently
+# relies on an out-of-band Monasca installation.
+
+# Whether to enable Monasca.
+kolla_enable_monasca:
+
 ###############################################################################
 # Murano configuration.
 
diff --git a/etc/kayobe/kolla.yml b/etc/kayobe/kolla.yml
index ed3baeb0..1af896d7 100644
--- a/etc/kayobe/kolla.yml
+++ b/etc/kayobe/kolla.yml
@@ -180,6 +180,7 @@
 #kolla_enable_manila_backend_generic:
 #kolla_enable_manila_backend_hnas:
 #kolla_enable_mistral:
+#kolla_enable_monasca:
 #kolla_enable_mongodb:
 #kolla_enable_multipathd:
 #kolla_enable_murano:
-- 
GitLab