browbeat/ansible/install/roles/grafana-prometheus-dashboards/tasks/main.yaml
Lucas H. Xu 219a5122fd Add new support for Prometheus/Grafana/Collectd
This patch adds the support for using Prometheus with
Grafana and Collectd. Automated the most panels within the
openstack system performance dashboad.

To test it:

$ansible-playbook -i hosts install/grafana-prometheus-dashboards.yml

And make sure add grafana-api-key in the group_vars/all.yml

Co-authored-by: Asma Syed Hameed <asyedham@redhat.com>
Co-authored-by: Sai Sindhur Malleni <smalleni@redhat.com>

Change-Id: Icb9fa058324165c0d304dc1dcf2dd843662307cf
2020-08-06 02:20:32 +00:00

39 lines
1.4 KiB
YAML

---
#
# Generate & Upload Browbeat OpenStack Grafana Dashboards
#
# check that grafana_apikey is entered prior to playbook run
- name: Check Grafana API key
fail:
msg="** Edit grafana_apikey in ../install/group_vars/all.yml before running **"
when: grafana_apikey is none
- name: Check Cloud Name
fail:
msg: "The Cloud name {{dashboard_cloud_name}} is reserved for a service, please use a different one"
when: item == dashboard_cloud_name
with_items: "{{forbidden_cloud_names}}"
# Templated General Performance Dashboards
- name: Generate General Performance Dashboards
template:
src: "{{role_path}}/templates/{{item.template_name}}_general_system_performance.yaml.j2"
dest: "{{role_path}}/files/{{item.process_list_name}}_general_system_performance.yaml"
when: upload_general|bool
with_items: "{{general_dashboards}}"
- name: Upload General Performance Dashboards to Grafana
shell: |
. {{browbeat_venv}}/bin/activate
grafana-dashboard --grafana-url http://{{grafana_host}}:{{grafana_port}} --grafana-apikey {{grafana_apikey}} update {{role_path}}/files/{{item.process_list_name}}_general_system_performance.yaml
when: upload_general|bool
with_items: "{{general_dashboards}}"
- name: Remove leftover yaml file(s) from General Performance Dashboards
file:
path: "{{role_path}}/files/{{item.process_list_name}}_general_system_performance.yaml"
state: absent
when: upload_general|bool
with_items: "{{general_dashboards}}"