You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I attempted to use the role grafana.grafana.grafana without provisioning, that is, setting grafana_use_provisioning to false and I stumbled, first upon the following issue (to get this I set no_log to false for task "Import grafana dashboards via api" from roles/grafana/tasks/dashboards.yml).
Parameter message is not accepted by module community.grafana.grafana_dashboard. I am using version 2.0.0 of the community.grafana collection. In the changelog, they state,
removed deprecated message argument in grafana_dashboard
so it makes sense. However, I have tried with earlier versions too, for example v1.9.1 or 1.8.0. They also fail because the module contains the following lines of code. In fact, all available versions except v0.1.0, v1.9.0 (apparently by mistake) and the latest (v2.0.0) contain them.
if"message"inmodule.params:
module.fail_json(
msg="'message' is reserved keyword, please change this parameter to 'commit_message'"
)
Therefore, I actually expect the task to fail regardless of the version of community.grafana that is installed.
Second, if I comment the line message: "Updated by ansible role {{ ansible_role_name }}" from that task to bypass the issue, then I face another issue.
[...]$ ansible-playbook grafana.yml
PLAY [Grafana] ************************************************************************
TASK [Gathering Facts] ****************************************************************
ok: [xxx.xxx.xxx.xxx]
...
TASK [grafana.grafana.grafana : Import grafana dashboards via api] *********************************************************************************************************************
failed: [xxx.xxx.xxx.xxx] (item=/home/.../files/grafana/Alerts.json) => {"ansible_loop_var": "item", "changed": false, "item": "/home/.../files/grafana/Alerts.json", "msg": "error : Can't load json file [Errno 2] No such file or directory: '/home/.../files/grafana/Alerts.json'"}
... (one failure for each dashboard)
failed: [xxx.xxx.xxx.xxx] (item=/home/.../files/grafana/uWSGI.json) => {"ansible_loop_var": "item", "changed": false, "item": "/home/.../files/grafana/uWSGI.json", "msg": "error : Can't load json file [Errno 2] No such file or directory: '/home/.../files/grafana/uWSGI.json'"}
PLAY RECAP *****************************************************************************************************************************************************************************
xxx.xxx.xxx.xxx : ok=87 changed=1 unreachable=0 failed=1 skipped=75 rescued=0 ignored=0
This actually happens because community.grafana.grafana_dashboard is looking for the dashboards on the server rather than on the control node. To verify this, I copied /home/.../files/grafana/Alerts.json to the same directory on the server before running the playbook, then after running it I got the following output.
[...]$ ansible-playbook grafana.yml
PLAY [Grafana] ************************************************************************
TASK [Gathering Facts] ****************************************************************
ok: [xxx.xxx.xxx.xxx]
...
TASK [grafana.grafana.grafana : Import grafana dashboards via api] *********************************************************************************************************************
ok: [xxx.xxx.xxx.xxx] => (item=/home/.../files/grafana/Alerts.json)
... (one failure for each remaining dashboard)
failed: [xxx.xxx.xxx.xxx] (item=/home/.../files/grafana/uWSGI.json) => {"ansible_loop_var": "item", "changed": false, "item": "/home/.../files/grafana/uWSGI.json", "msg": "error : Can't load json file [Errno 2] No such file or directory: '/home/.../files/grafana/uWSGI.json'"}
PLAY RECAP *****************************************************************************************************************************************************************************
xxx.xxx.xxx.xxx : ok=87 changed=1 unreachable=0 failed=1 skipped=75 rescued=0 ignored=0
The dashboard for which the task completed successfully shows up in Grafana, so fixing these two issues should be all that's needed.
The text was updated successfully, but these errors were encountered:
Hi! I attempted to use the role
grafana.grafana.grafana
without provisioning, that is, settinggrafana_use_provisioning
tofalse
and I stumbled, first upon the following issue (to get this I setno_log
tofalse
for task "Import grafana dashboards via api" from roles/grafana/tasks/dashboards.yml).Parameter
message
is not accepted by modulecommunity.grafana.grafana_dashboard
. I am using version 2.0.0 of thecommunity.grafana
collection. In the changelog, they state,so it makes sense. However, I have tried with earlier versions too, for example v1.9.1 or 1.8.0. They also fail because the module contains the following lines of code. In fact, all available versions except v0.1.0, v1.9.0 (apparently by mistake) and the latest (v2.0.0) contain them.
Therefore, I actually expect the task to fail regardless of the version of
community.grafana
that is installed.Second, if I comment the line
message: "Updated by ansible role {{ ansible_role_name }}"
from that task to bypass the issue, then I face another issue.This actually happens because
community.grafana.grafana_dashboard
is looking for the dashboards on the server rather than on the control node. To verify this, I copied /home/.../files/grafana/Alerts.json to the same directory on the server before running the playbook, then after running it I got the following output.The dashboard for which the task completed successfully shows up in Grafana, so fixing these two issues should be all that's needed.
The text was updated successfully, but these errors were encountered: