community.grafana.grafana_annotations callback – send ansible events as annotations on charts to grafana over http api.

Note

This callback plugin is part of the community.grafana collection (version 1.9.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.grafana. You need further requirements to be able to use this callback plugin, see Requirements for details.

To use it in a playbook, specify: community.grafana.grafana_annotations.

Callback plugin

This plugin is a notification callback. It sends information for a playbook run to other applications, services, or systems. See Callback plugins for more information on callback plugins.

Synopsis

  • This callback will report start, failed and stats events to Grafana as annotations (https://grafana.com)

Requirements

The below requirements are needed on the local controller node that executes this callback.

  • whitelisting in configuration

Parameters

Parameter

Comments

grafana_api_key

string

Grafana API key, allowing to authenticate when posting on the HTTP API. If not provided, grafana_login and grafana_password will be required.

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_api_key = VALUE
    
  • Environment variable: GRAFANA_API_KEY

grafana_dashboard_id

integer

The grafana dashboard id where the annotation shall be created.

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_dashboard_id = VALUE
    
  • Environment variable: GRAFANA_DASHBOARD_ID

grafana_panel_ids

list / elements=integer

The grafana panel ids where the annotation shall be created. Give a single integer or a comma-separated list of integers.

Default: []

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_panel_ids =
    
  • Environment variable: GRAFANA_PANEL_IDS

grafana_password

string

Grafana password used for authentication. Ignored if grafana_api_key is provided.

Default: "ansible"

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_password = ansible
    
  • Environment variable: GRAFANA_PASSWORD

grafana_url

string / required

Grafana annotations api URL

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_url = VALUE
    
  • Environment variable: GRAFANA_URL

grafana_user

string

Grafana user used for authentication. Ignored if grafana_api_key is provided.

Default: "ansible"

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    grafana_user = ansible
    
  • Environment variable: GRAFANA_USER

http_agent

string

The HTTP ‘User-agent’ value to set in HTTP requets.

Default: "Ansible (grafana_annotations callback)"

Configuration:

  • INI entry:

    [callback_grafana_annotations]
    http_agent = Ansible (grafana_annotations callback)
    
  • Environment variable: HTTP_AGENT

validate_certs

aliases: validate_grafana_certs

boolean

validate the SSL certificate of the Grafana server. (For HTTPS url)

Choices:

  • false

  • true ← (default)

Configuration:

  • INI entries:

    [callback_grafana_annotations]
    validate_grafana_certs = true
    
    [callback_grafana_annotations]
    validate_certs = true
    
  • Environment variable: GRAFANA_VALIDATE_CERT

Authors

  • Rémi REY (@rrey)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.