grafana / grafana-ansible-collection

grafana.grafana Ansible collection provides modules and roles for managing various resources on Grafana Cloud and roles to manage and deploy Grafana Agent and Grafana
https://docs.ansible.com/ansible/latest/collections/grafana/grafana/index.html#plugins-in-grafana-grafana
GNU General Public License v3.0
136 stars 87 forks source link

Remove Legacy alerting > v11.0.0 #288

Open tayfun57 opened 2 weeks ago

tayfun57 commented 2 weeks ago

When installing a grafana version newer than v11.0.0, grafana will not start.

If you remove the following lines from: roles/grafana/templates/grafana.ini.j2

{% if grafana_version != 'latest' and grafana_version.split('.')[0]|int < 11 %}

Alerting

[alerting] {% if grafana_alerting != {} %} enabled = true {% for k,v in grafana_alerting.items() %} {% if k != 'enabled' %} {{ k }} = {{ v }} {% endif %} {% endfor %} {% else %} enabled = false {% endif %} {% endif %}

I will work for me.

Error log:

logger=settings t=2024-11-01T14:26:41.858695142Z level=error msg="Option '[alerting].enabled' cannot be true. Legacy Alerting is removed. It is no longer deployed, enhanced, or supported. Delete '[alerting].enabled' and use '[unified_alerting].enabled' to enable Grafana Alerting. For more information, refer to the documentation on upgrading to Grafana Alerting (https://grafana.com/docs/grafana/v10.4/alerting/set-up/migrating-alerts)"

voidquark commented 2 weeks ago

Could you please confirm that you are using the latest version of the collection?

If your Grafana version is v11 or higher, the template uses [unified_alerting] instead of [alerting]. I’m not sure why you want to remove this part, as the current logic allows for deploying both older and newer versions. The conditional statement simply determines which alerting block to use based on the version:

{% if grafana_version == 'latest' or grafana_version.split('.')[0]|int >= 11 %}
# Unified Alerting
[unified_alerting]
.....

{% if grafana_version != 'latest' and grafana_version.split('.')[0]|int < 11 %}
# Alerting
[alerting]
.....
voidquark commented 13 hours ago

@tayfun57 can you confirm above comment ?