Skip to content

Commit 2ddf74c

Browse files
authored
Merge pull request #932 from CODING-Enthusiast9857/grafana_bridge_roles_dev_new
Grafana Bridge Install, Configure & Verify Roles updated
2 parents 26866c2 + 2a1c560 commit 2ddf74c

File tree

23 files changed

+398
-0
lines changed

23 files changed

+398
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
IBM Spectrum Scale Bridge for Grafana Ansible Role
2+
=================================================
3+
4+
Highly-customizable Ansible role for installing & configuring IBM Spectrum Scale Bridge for Grafana, enabling performance metrics visualization through Grafana dashboards.
5+
6+
7+
Features
8+
--------
9+
10+
- **Install Grafana Bridge**
11+
- **Support for Python 3.8 or above environments**
12+
- **Install via YUM repo or local RPMs**
13+
- **Systemd service management for Grafana Bridge**
14+
- **Customizable log file paths**
15+
- **Modular role design for install, configure, and verify steps**
16+
17+
The following installation methods are available:
18+
- **Install from existing YUM repository**
19+
- **Install from local RPM package**
20+
21+
22+
Future plans:
23+
- **Automated certificate handling for HTTPS endpoints.**
24+
- **Enhanced metrics filtering**
25+
26+
27+
Installation
28+
------
29+
Installation
30+
31+
```
32+
$ ansible-playbook -i hosts playbook_grafana_bridge.yml
33+
```
34+
35+
36+
Requirements
37+
-------------
38+
39+
Public repository available, you'll need to download it from here https://github.com/IBM/ibm-spectrum-scale-bridge-for-grafana
40+
41+
42+
Role Variables
43+
---------------
44+
45+
The following variables can be customized to configure the IBM Spectrum Scale Bridge for Grafana:
46+
47+
- **opentsdb_port**: Port for OpenTSDB plugin. Example: `4242` for HTTP or `8443` for HTTPS
48+
49+
- **prometheus_port**: Port for Prometheus metrics endpoint. Example: `9250`
50+
51+
- **encoded_password**: Encoded password used for Grafana Bridge authentication. Example: `TXlWZXJ5U3Ryb25nUGFzc3cwcmQhCg`
52+
53+
- **transport**: Transport protocol for Grafana Bridge. Options: `http` or `https`
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
galaxy_info:
3+
author: IBM Corporation
4+
description: Role for installing IBM Storage Scale Bridge for Grafana
5+
company: IBM
6+
7+
license: Apache-2.0
8+
9+
min_ansible_version: 2.9
10+
11+
platforms:
12+
- name: EL
13+
versions:
14+
- 8
15+
- 9
16+
17+
galaxy_tags: []
18+
19+
dependencies: []
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
- name: Generate API key
2+
command: "{{ mmperfmon_path }} config add --apikey scale_grafana"
3+
register: api_gen
4+
changed_when: "'already exists' not in api_gen.stderr"
5+
when: config_stat.stat.exists
6+
7+
- name: Get API key value
8+
command: "{{ mmperfmon_path }} config show --apikey scale_grafana"
9+
register: api_show
10+
when: config_stat.stat.exists
11+
12+
- name: Extract API Key from JSON Output
13+
set_fact:
14+
api_key_value: "{{ api_show.stdout | from_json | dict2items | selectattr('key', 'equalto', 'key') | map(attribute='value') | first }}"
15+
when: config_stat.stat.exists
16+
17+
- name: Extract API key from JSON
18+
set_fact:
19+
api_key_value: "{{ (api_show.stdout | from_json).key }}"
20+
when: config_stat.stat.exists
21+
22+
- name: Set API key in config.ini
23+
community.general.ini_file:
24+
path: "{{ config_file }}"
25+
section: server
26+
option: apiKeyValue
27+
value: "{{ api_key_value }}"
28+
when: config_stat.stat.exists
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- name: Check if config.ini exists
2+
stat:
3+
path: "{{ config_file }}"
4+
register: config_stat
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- name: Update logPath to /var/adm/ras
2+
replace:
3+
path: "{{ config_file }}"
4+
regexp: '^logPath\s*=.*'
5+
replace: "logPath = /var/adm/ras"
6+
when: config_stat.stat.exists
7+
8+
- name: Update zserver.log to ibmgrafanabridge.log
9+
replace:
10+
path: "{{ config_file }}"
11+
regexp: '^logFile\s*=.*'
12+
replace: "logFile = ibmgrafanabridge.log"
13+
when: config_stat.stat.exists
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# Configure IBM Spectrum Scale Bridge for Grafana
3+
- import_tasks: configure.yml
4+
tags: configure
5+
when: config_file is defined
6+
7+
- import_tasks: ports.yml
8+
tags: ports
9+
when: config_stat.stat.exists
10+
11+
- import_tasks: secret.yml
12+
tags: secret
13+
when: config_stat.stat.exists
14+
15+
- import_tasks: apikey.yml
16+
tags: apikey
17+
when: config_stat.stat.exists
18+
19+
- import_tasks: log.yml
20+
tags: log
21+
when: config_stat.stat.exists
22+
23+
- import_tasks: systemd.yml
24+
tags: service
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: Ensure OpenTSDB Port (HTTP or HTTPs) is set correctly
2+
community.general.ini_file:
3+
path: "{{ config_file }}"
4+
section: opentsdb_plugin
5+
option: port
6+
value: "{{ scale_grafana_bridge.opentsdb_port }}"
7+
when:
8+
- config_stat.stat.exists
9+
10+
- name: Ensure Prometheus Port is set correctly
11+
community.general.ini_file:
12+
path: "{{ config_file }}"
13+
section: prometheues_exporter_plugin
14+
option: prometheus
15+
value: "{{ scale_grafana_bridge.prometheus_port }}"
16+
when:
17+
- config_stat.stat.exists
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- name: Ensure password is set if not found
2+
community.general.ini_file:
3+
path: "{{ config_file }}"
4+
section: basic_auth
5+
option: password
6+
value: "{{ scale_grafana_bridge.encoded_password }}"
7+
when:
8+
- config_stat.stat.exists
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- name: Reload systemd
2+
ansible.builtin.systemd:
3+
daemon-reload: yes
4+
5+
- name: Enable grafana-bridge service
6+
ansible.builtin.systemd:
7+
name: grafana-bridge
8+
enabled: true
9+
state: restarted
10+
11+
- name: Start grafana-bridge service
12+
systemd:
13+
name: grafana-bridge
14+
state: started
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
# vars file for grafana_bridge_configure
3+
mmperfmon_path: "/usr/lpp/mmfs/bin/mmperfmon"
4+
config_file: "/opt/IBM/bridge/source/config.ini"

0 commit comments

Comments
 (0)