grafana-ansible-collection icon indicating copy to clipboard operation
grafana-ansible-collection copied to clipboard

add option to populate google_analytics_4_id value

Open copolycube opened this issue 1 year ago • 4 comments

google_analytics_4_id isn't populated in the current j2 grafana.ini template

cf. https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#google_analytics_4_id (note: other values might be needed)

copolycube avatar Jul 24 '24 22:07 copolycube

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 24 '24 22:07 CLAassistant

cc @gardar

ishanjainn avatar Jul 26 '24 07:07 ishanjainn

A way to bypass is to manually add a task after the role to edit the file with community.general.ini_file

    - name: Grafana.ini google_analytics_4_id setup
      become: true
      community.general.ini_file: 
        path: /etc/grafana/grafana.ini 
        section: analytics 
        option: google_analytics_4_id 
        value: "{{ lookup('ansible.builtin.env', 'VAR_google_analytics_4_id') }}" 
        backup: true

copolycube avatar Aug 09 '24 18:08 copolycube

@gardar , is there anything I can help with to have this merged ? Thanks in advance !

copolycube avatar Sep 30 '24 19:09 copolycube

Hello, has this been removed from the 6.0.1 version of the role ? I see a failure at preflight when grafana_analytics is defined.

cmehat avatar May 30 '25 20:05 cmehat

Use grafana_ini.analytics.google_analytics_4_id. Any grafana.ini setting can now be set via grafana_ini, no explicit support is required by ansible role.

Example:

  roles:
    - name: grafana.grafana.grafana
      vars:
        grafana_ini:
          analytics:
            google_analytics_4_id: XXXX

intermittentnrg avatar Jun 04 '25 04:06 intermittentnrg