kayobe/ansible/overcloud-grafana-configure.yml
Doug Szumski cdc1d5ada2 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
2020-03-30 15:13:15 +02:00

86 lines
3.3 KiB
YAML

---
- 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_monasca | bool }}"
- name: Set the Monasca control plane project ID
hosts: monitoring_with_grafana_enabled_True[0]
gather_facts: False
tags:
- 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 }}"
os_openstackclient_install_epel: "{{ yum_install_epel }}"
os_openstackclient_state: latest
os_openstackclient_upper_constraints_file: "{{ pip_upper_constraints_file }}"
when: kolla_enable_monasca | bool
tasks:
- name: Look up Monasca control plane project ID
shell: >
source {{ venv }}/bin/activate &&
openstack project show {{ grafana_control_plane_organisation.split("@")[0] }} --format json --column id
register: monasca_project_show
changed_when: False
environment: "{{ openstack_auth_env }}"
when: kolla_enable_monasca | bool
- 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 | bool
- name: Configure control plane monitoring for Grafana
# Only required to run on a single host.
hosts: monitoring_with_grafana_enabled_True[0]
gather_facts: False
tags:
- grafana
pre_tasks:
- name: Set fact for the VIP address
set_fact:
kolla_internal_vip_address: "{{ internal_net_name | net_vip_address }}"
when: kolla_enable_haproxy | bool
- name: Set fact for the VIP address
set_fact:
kolla_internal_vip_address: "{{ internal_net_name | net_ip }}"
when: not kolla_enable_haproxy | bool
- name: Include Kolla passwords for Grafana local admin account credentials
include_vars: "{{ kayobe_config_path }}/kolla/passwords.yml"
roles:
- 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: "{{ monasca_grafana_admin_password }}"
grafana_conf_grafana_dashboard_repo:
repo: "{{ grafana_monitoring_node_dashboard_repo }}"
version: "{{ grafana_monitoring_node_dashboard_repo_version }}"
checkout_path: "{{ grafana_monitoring_node_dashboard_repo_checkout_path }}"
relative_path: "{{ grafana_monitoring_node_dashboard_repo_path }}"
grafana_conf_grafana_url: "http://{{ kolla_internal_vip_address }}:3000"
grafana_conf_grafana_datasources: "{{ grafana_datasources }}"