Fix loading of Monasca Grafana dashboards

This is a minimal fix to support loading dashboards into the Monasca
Grafana fork. It firstly aligns the default Monasca Grafana control
plane organisation and Monasca Grafana local admin username with Kolla
Ansible to make the feature easier to use. Secondly, it extracts the
associated OpenStack project name from this variable by stripping off
the OpenStack domain.

Longer term we may wish to move the dashboard loading functionality into
Kolla Ansible, now that it supports deploying Monasca.

Affects Rocky onwards.

Change-Id: I77c94edf654565a12ce8be681e3c9b16caa55c86
Story: 2007477
Task: 39186
This commit is contained in:
Doug Szumski 2020-03-28 17:08:38 +00:00 committed by Pierre Riteau
parent 35ccc0d2cc
commit cdc1d5ada2
3 changed files with 26 additions and 6 deletions

View File

@ -4,7 +4,7 @@
# Grafana local admin user name. If you are deploying Monasca Grafana this
# should not conflict with an OpenStack user name.
grafana_local_admin_user_name: "admin"
grafana_local_admin_user_name: "grafana_local_admin"
# Path to git repo containing Grafana dashboards. Eg.
# https://github.com/stackhpc/grafana-reference-dashboards.git
@ -23,7 +23,7 @@ grafana_monitoring_node_dashboard_repo_path:
# The Grafana organisation for the control plane. Note that for Monasca
# Grafana with domain support the format is:
# organisation_name@openstack_domain
grafana_control_plane_organisation: "control_plane"
grafana_control_plane_organisation: "monasca_control_plane@default"
# A dict of datasources to configure. See the stackhpc.grafana-conf role
# for all supported datasources. Example:

View File

@ -1,12 +1,12 @@
---
- name: Check whether Grafana is enabled
- name: Check whether Monasca is enabled
hosts: overcloud
tags:
- grafana
tasks:
- name: Create monitoring group with grafana enabled
group_by:
key: "monitoring_with_grafana_enabled_{{ kolla_enable_grafana | bool }}"
key: "monitoring_with_grafana_enabled_{{ kolla_enable_monasca | bool }}"
- name: Set the Monasca control plane project ID
hosts: monitoring_with_grafana_enabled_True[0]
@ -15,6 +15,20 @@
- grafana
vars:
venv: "{{ virtualenv_path }}/openstacksdk"
pre_tasks:
- name: Validate OpenStack password authentication parameters
fail:
msg: >
Required OpenStack authentication parameter {{ item }} is
{% if item in openstack_auth %}empty{% else %}not present{% endif %}
in openstack_auth. Have you sourced the environment file?
when:
- openstack_auth_type == 'password'
- item not in openstack_auth or not openstack_auth[item]
with_items: "{{ openstack_auth_password_required_params }}"
tags:
- config-validation
roles:
- role: stackhpc.os-openstackclient
os_openstackclient_venv: "{{ venv }}"
@ -27,7 +41,7 @@
- name: Look up Monasca control plane project ID
shell: >
source {{ venv }}/bin/activate &&
openstack project show monasca --format json --column id
openstack project show {{ grafana_control_plane_organisation.split("@")[0] }} --format json --column id
register: monasca_project_show
changed_when: False
environment: "{{ openstack_auth_env }}"
@ -61,7 +75,7 @@
- role: stackhpc.grafana-conf
grafana_conf_organisation: "{{ grafana_control_plane_organisation }}"
grafana_conf_grafana_admin_user: "{{ grafana_local_admin_user_name }}"
grafana_conf_grafana_admin_pass: "{{ grafana_admin_password }}"
grafana_conf_grafana_admin_pass: "{{ monasca_grafana_admin_password }}"
grafana_conf_grafana_dashboard_repo:
repo: "{{ grafana_monitoring_node_dashboard_repo }}"
version: "{{ grafana_monitoring_node_dashboard_repo_version }}"

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes an issue where it was not possible to load dashboards into the
Monasca Grafana fork when the default Monasca control plane OpenStack
project name is used from Kolla Ansible.