fix linter errors

This commit is contained in:
Sergey Malyuk
2025-12-12 16:10:28 +03:00
parent e7e8a1b8ab
commit c3b6c01c6d
12 changed files with 74 additions and 74 deletions

View File

@@ -14,7 +14,7 @@ This role installs and configures Grafana from a binary distribution. It also:
- Allows admin password changes
Supports user creation
Grafana service requires an environment file at startup, where you can set custom paths for logs (`log_dir`), data (`data_dir`), and plugins (`plugins_dir`). This allows flexible control over Grafana's data storage.
Grafana service requires an environment file at startup, where you can set custom paths for logs (`grafana_log_dir`), data (`grafana_data_dir`), and plugins (`grafana_plugins_dir`). This allows flexible control over Grafana's data storage.
Requirements
------------
@@ -31,11 +31,11 @@ grafana_version: 11.5.0 # version
grafana_port: 3000 # port
# Directory paths
dashboard_dir: "/tmp/grafana/dashboards" # where to copy dashboards from source
plugins_dir: "/var/lib/grafana/plugins" # where to store plugins on target
datasource_dir: "/etc/grafana/provisioning/datasources" # where to store data sources on target
log_dir: "/var/log/grafana" # where to write logs
data_dir: "/var/lib/grafana" # where to store Grafana DB
grafana_dashboard_dir: "/tmp/grafana/dashboards" # where to copy dashboards from source
grafana_plugins_dir: "/var/lib/grafana/plugins" # where to store plugins on target
grafana_datasource_dir: "/etc/grafana/provisioning/datasources" # where to store data sources on target
grafana_log_dir: "/var/log/grafana" # where to write logs
grafana_data_dir: "/var/lib/grafana" # where to store Grafana DB
# Optional configurations
grafana_users: [] # array of user names, passwords, and statuses
@@ -91,8 +91,8 @@ Example Playbook
public_dashboards: "{{ grafana_public_dashboards }}"
dashboard_source_path: "molecule/default/dashboards"
datasource_source_path: "molecule/default/datasources"
log_dir: "/opt/grafana/data"
data_dir: "/opt/grafana/lib"
grafana_log_dir: "/opt/grafana/data"
grafana_data_dir: "/opt/grafana/lib"
```

View File

@@ -3,8 +3,8 @@ grafana_user: "grafana"
grafana_group: "grafana"
grafana_version: 11.5.0
grafana_port: 3000
dashboard_dir: "/tmp/grafana/dashboards"
plugins_dir: "/var/lib/grafana/plugins"
datasource_dir: "/etc/grafana/provisioning/datasources"
log_dir: "/var/log/grafana"
data_dir: "/var/lib/grafana"
grafana_dashboard_dir: "/tmp/grafana/dashboards"
grafana_plugins_dir: "/var/lib/grafana/plugins"
grafana_datasource_dir: "/etc/grafana/provisioning/datasources"
grafana_log_dir: "/var/log/grafana"
grafana_data_dir: "/var/lib/grafana"

View File

@@ -31,7 +31,7 @@
roles:
# kics-scan ignore-block
- role: genlab.grafana
- role: genlab.common.grafana
grafana_version: 11.5.0
admin_api_username: "{{ grafana.admin_api_username }}"
admin_api_password: "{{ grafana.admin_api_password }}"
@@ -40,5 +40,5 @@
public_dashboards: "{{ grafana_public_dashboards }}"
dashboard_source_path: "molecule/default/dashboards"
datasource_source_path: "molecule/default/datasources"
log_dir: "/opt/grafana/data"
data_dir: "/opt/grafana/lib"
grafana_log_dir: "/opt/grafana/data"
grafana_data_dir: "/opt/grafana/lib"

View File

@@ -1,7 +1,7 @@
---
- name: "Create dashboard directory"
ansible.builtin.file:
path: "{{ dashboard_dir }}"
path: "{{ grafana_dashboard_dir }}"
state: directory
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
@@ -10,7 +10,7 @@
- name: "Copy dashboard files from source to target"
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ dashboard_dir }}/{{ item | basename }}"
dest: "{{ grafana_dashboard_dir }}/{{ item | basename }}"
mode: "0644"
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
@@ -25,7 +25,7 @@
state: present
commit_message: Updated by ansible
overwrite: false
path: "{{ dashboard_dir }}/{{ item | basename }}"
path: "{{ grafana_dashboard_dir }}/{{ item | basename }}"
with_fileglob:
- "{{ dashboard_source_path }}/*.json"

View File

@@ -1,7 +1,7 @@
---
- name: "Create datasource directory"
ansible.builtin.file:
path: "{{ datasource_dir }}"
path: "{{ grafana_datasource_dir }}"
state: directory
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
@@ -10,7 +10,7 @@
- name: "Configure | provision datasources for Grafana"
ansible.builtin.copy:
src: "{{ datasource_source_path }}/{{ item | basename }}"
dest: "{{ datasource_dir }}/{{ item | basename }}"
dest: "{{ grafana_datasource_dir }}/{{ item | basename }}"
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: "0660"

View File

@@ -37,9 +37,9 @@
group: "{{ grafana_group }}"
mode: '0775'
with_items:
- "{{ log_dir }}"
- "{{ data_dir }}"
- "{{ plugins_dir }}"
- "{{ grafana_log_dir }}"
- "{{ grafana_data_dir }}"
- "{{ grafana_plugins_dir }}"
- name: "Download Grafana DEB package"
ansible.builtin.get_url:
@@ -48,12 +48,12 @@
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
mode: "0644"
register: package_tmp
register: grafana_package_tmp
- name: "Install DEB package"
notify: "(Re)start and enable Grafana"
ansible.builtin.apt:
deb: "{{ package_tmp.dest }}"
deb: "{{ grafana_package_tmp.dest }}"
state: present
update_cache: true

View File

@@ -1,7 +1,7 @@
---
- name: "Create plugin directory"
ansible.builtin.file:
path: "{{ plugins_dir }}"
path: "{{ grafana_plugins_dir }}"
state: directory
owner: "{{ grafana_user }}"
group: "{{ grafana_group }}"
@@ -11,6 +11,6 @@
community.grafana.grafana_plugin:
name: "{{ plugin.name }}"
version: "{{ plugin.version }}"
grafana_plugins_dir: "{{ plugins_dir }}"
grafana_plugins_dir: "{{ grafana_plugins_dir }}"
state: "{{ plugin.state | default('present') }}"
notify: "(Re)start and enable Grafana"

View File

@@ -4,9 +4,9 @@ GRAFANA_GROUP=grafana
GRAFANA_HOME=/usr/share/grafana
LOG_DIR={{ log_dir }}
LOG_DIR={{ grafana_log_dir }}
DATA_DIR={{ data_dir }}
DATA_DIR={{ grafana_data_dir }}
MAX_OPEN_FILES=10000
@@ -16,7 +16,7 @@ CONF_FILE=/etc/grafana/grafana.ini
RESTART_ON_UPGRADE=true
PLUGINS_DIR={{ plugins_dir }}
PLUGINS_DIR={{ grafana_plugins_dir }}
PROVISIONING_CFG_DIR=/etc/grafana/provisioning