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

Declare Module default groups #224

Open Derioss opened 5 months ago

Derioss commented 5 months ago

Official Ansible doc

Hello !

it's very nice to declare group in meta/runtime.yml for remove some duplicate code when we use this grafana module.

for example:

- name: Usage of module is_default
  module_defaults:
    group/grafana:
      grafana_url: "https://{{ monitoring_grafana_server_name }}"
      grafana_user: "{{ monitoring_grafana_user }}"
      grafana_password: "{{ monitoring_grafana_pass }}"
      use_proxy: false
      validate_certs: false
  block:
    - name: Add prometheus datasource
      community.grafana.grafana_datasource:
        name: prometheus
        ds_type: prometheus
        access: direct
        is_default: true
        ds_url: http://prometheus:9090

    - name: Load grafana dashboard
      community.grafana.grafana_dashboard:
        folder: "{{ item.folder }}"
        dashboard_id: "{{ item.dashboard_id }}"
        dashboard_revision: "{{ item.dashboard_revision }}"

Thanks !