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.5.0).

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.

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

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 = None
    
  • 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 = None
    
  • 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 = None
    
  • 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:

  • no

  • yes ← (default)

Configuration:

  • INI entries:

    [callback_grafana_annotations]
    validate_grafana_certs = yes
    
    [callback_grafana_annotations]
    validate_certs = yes
    
  • 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.