grafana
Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- , , , , , , , ,
Tasks:
- change_grafana_admin_password
Start using this module
Add this module to your Puppetfile:
mod 'puppet-grafana', '14.1.0'
Learn more about managing modules with a PuppetfileDocumentation
grafana
Table of Contents
Overview
This module installs Grafana, a dashboard and graph editor for Graphite, InfluxDB and OpenTSDB.
Module Description
With the 9.0.0 release of this module we only support Grafana 6.x/7.x/8.x. Version 8 of the module was tested successfully on Grafana 6 and 7.
Setup
This module will:
- Install Grafana using your preferred method: package (default), Docker container, or tar archive
- Allow you to override the version of Grafana to be installed, and / or the package source
- Perform basic configuration of Grafana
Requirements
- If using an operating system of the Debian-based family, and the "repo"
install_method
, you will need to ensure that puppetlabs-apt version 4.x is installed. - If using Docker, you will need the garethr/docker module version 5.x
Beginning with Grafana
To install Grafana with the default parameters:
class { 'grafana': }
This assumes that you want to install Grafana using the 'package' method. To establish customized parameters:
class { 'grafana':
install_method => 'docker',
}
Usage
Classes and Defined Types
Class: grafana
The Grafana module's primary class, grafana
, guides the basic setup of Grafana
on your system.
class { 'grafana': }
Parameters within grafana
:
archive_source
The download location of a tarball to use with the 'archive' install method. Defaults to the URL of the latest version of Grafana available at the time of module release.
cfg_location
Configures the location to which the Grafana configuration is written. The default location is '/etc/grafana/grafana.ini'.
cfg
Manages the Grafana configuration file. Grafana comes with its own default settings in a different configuration file (/opt/grafana/current/conf/defaults.ini), therefore this module does not supply any defaults.
This parameter only accepts a Hash
(or Sensitive[Hash]
) as its value. Keys with hashes as values will
generate sections, any other values are just plain values. The example below will
result in...
class { 'grafana':
cfg => {
app_mode => 'production',
server => {
http_port => 8080,
},
database => {
type => 'mysql',
host => '127.0.0.1:3306',
name => 'grafana',
user => 'root',
password => '',
},
users => {
allow_sign_up => false,
},
},
}
...the following Grafana configuration:
# This file is managed by Puppet, any changes will be overwritten
app_mode = production
[server]
http_port = 8080
[database]
type = mysql
host = 127.0.0.1:3306
name = grafana
user = root
password =
[users]
allow_sign_up = false
Some minor notes:
- If you want empty values, just use an empty string.
- Keys that contains dots (like auth.google) need to be quoted.
- The order of the keys in this hash is the same as they will be written to the configuration file. So settings that do not fall under a section will have to come before any sections in the hash.
- If your configuration contains secrets you want hidden in Puppet log output and reports
use a
Sensitive[Hash]
instead of a normalHash
ldap_cfg
Manages the Grafana LDAP configuration file. This hash is directly translated into the corresponding TOML file, allowing for full flexibility in generating the configuration.
See the LDAP documentation for more information.
TOML note
This option requires the toml gem. Either install the gem using puppet's native gem provider, puppetserver_gem, pe_gem, pe_puppetserver_gem, or manually using one of the following:
# apply or puppet-master
gem install toml
# PE apply
/opt/puppet/bin/gem install toml
# AIO or PE puppetserver
/opt/puppet/bin/puppetserver gem install toml
secrets
LDAP configuration usually contains secrets. If you want to stop these being leaked in logs and reports,
the ldap_cfg
parameter will optionally accept the Sensitive
data type.
cfg note
This option by itself is not sufficient to enable LDAP configuration as it must be enabled in the main configuration file. Enable it in cfg with:
'auth.ldap' => {
enabled => 'true',
config_file => '/etc/grafana/ldap.toml',
},
Example LDAP config
ldap_cfg => Sensitive({
servers => [
{ host => 'ldapserver1.domain1.com',
port => 636,
use_ssl => true,
search_filter => '(sAMAccountName=%s)',
search_base_dns => [ 'dc=domain1,dc=com' ],
bind_dn => 'user@domain1.com',
bind_password => 'passwordhere',
},
],
'servers.attributes' => {
name => 'givenName',
surname => 'sn',
username => 'sAMAccountName',
member_of => 'memberOf',
email => 'mail',
}
}),
If you want to connect to multiple LDAP servers using different configurations, use an array to enwrap the configurations as shown below.
ldap_cfg => Sensitive([
{
servers => [
{
host => 'ldapserver1.domain1.com',
port => 636,
use_ssl => true,
search_filter => '(sAMAccountName=%s)',
search_base_dns => [ 'dc=domain1,dc=com' ],
bind_dn => 'user@domain1.com',
bind_password => 'passwordhere',
},
],
'servers.attributes' => {
name => 'givenName',
surname => 'sn',
username => 'sAMAccountName',
member_of => 'memberOf',
email => 'mail',
},
'servers.group_mappings' => [
{
group_dn => 'cn=grafana_viewers,ou=groups,dc=domain1,dc=com',
org_role => 'Viewer',
}
],
},
{
servers => [
{
host => 'ldapserver2.domain2.com',
port => 389,
use_ssl => false,
start_tls => true,
search_filter => '(uid=%s)',
search_base_dns => [ 'dc=domain2,dc=com' ],
bind_dn => 'user@domain2.com',
bind_password => 'passwordhere',
},
],
'servers.attributes' => {
name => 'givenName',
surname => 'sn',
username => 'uid',
member_of => 'memberOf',
email => 'mail',
}
'servers.group_mappings' => [
{
'group_dn' => 'cn=grafana_admins,ou=groups,dc=domain2,dc=com',
'org_role' => 'Admin',
'grafana_admin' => true,
}
],
},
])
#####
# or in hiera-yaml style
grafana::ldap_cfg:
- servers:
- host: ldapserver1.domain1.com
port: 636
use_ssl: true
search_filter: '(sAMAccountName=%s)'
search_base_dns: ['dc=domain1,dc=com']
bind_dn: 'user@domain1.com'
bind_password: 'passwordhere'
servers.attributes:
name: givenName
surname: sn
username: sAMAccountName
member_of: memberOf
email: mail
servers.group_mappings:
- group_dn: cn=grafana_viewers,ou=groups,dc=domain1,dc=com
org_role: Viewer
- servers:
- host: ldapserver2.domain2.com
port: 389
use_ssl: false
start_tls: true
search_filter: '(uid=%s)',
search_base_dns: ['dc=domain2,dc=com']
bind_dn: 'user@domain2.com'
bind_password: 'passwordhere'
servers.attributes:
name: givenName
surname: sn
username: uid
member_of: memberOf
email: mail
servers.group_mappings:
- group_dn: cn=grafana_admins,ou=groups,dc=domain2,dc=com
org_role: Admin
grafana_admin: true
#####
container_cfg
Boolean to control whether a configuration file should be generated when using the 'docker' install method. If 'true', use the 'cfg' and 'cfg_location' parameters to control creation of the file. Defaults to false.
container_params
A hash of parameters to use when creating the Docker container. For use with the 'docker' install method. Refer to documentation of the 'docker::run' resource in the garethr-docker module for details of available parameters. Defaults to:
container_params => {
'image' => 'grafana/grafana:latest',
'ports' => '3000:3000'
}
data_dir
The directory Grafana will use for storing its data. Defaults to '/var/lib/grafana'.
install_dir
The installation directory to be used with the 'archive' install method. Defaults to '/usr/share/grafana'.
install_method
Controls which method to use for installing Grafana. Valid options are: 'archive',
'docker', 'repo' and 'package'. The default is 'package'. If you wish to use the
'docker' installation method, you will need to include the 'docker' class in your
node's manifest / profile. If you wish to use the 'repo' installation method, you
can control whether the official Grafana repositories will be used. See
manage_package_repo
below for details.
manage_package_repo
Boolean. When using the 'repo' installation method, controls whether the official Grafana repositories are enabled on your host. If true, the official Grafana repositories will be enabled. If false, the module assumes you are managing your own package repository and will not set one up for you. Defaults to true.
plugins
Hash. This is a passthrough to call create_resources()
on the
grafana_plugin
resource type.
package_name
The name of the package managed with the 'package' install method. Defaults to 'grafana'.
package_source
The download location of a package to be used with the 'package' install method. Defaults to the URL of the latest version of Grafana available at the time of module release.
provisioning_datasources
A Hash which is converted to YAML for grafana to provision data sources. See provisioning grafana for details and example config file. Requires grafana > v5.0.0.
This is very useful with Hiera as you can provide a yaml hash/dictionary which will effectively 'passthrough' to grafana. See Advanced Usage for examples.
provisioning_dashboards
A Hash which is converted to YAML for grafana to provision dashboards. See provisioning grafana for details and example config file. Requires grafana > v5.0.0.
This is very useful with Hiera as you can provide a yaml hash/dictionary which will effectively 'passthrough' to grafana. See Advanced Usage for examples.
N.B. A option named puppetsource
may be given in the options
hash
which is not part of grafana's syntax. This option will be extracted
from the hash, and used to "source" a directory of dashboards. See
Advanced Usage for details.
provisioning_dashboards_file
A String that is used as the target file name for the dashabords provisioning file. This way the module can be used to generate placeholder files so password can be sepecified in a different iteration, avoiding them to be put in the module code.
provisioning_datasources_file
A String that is used as the target file name for the datasources provisioning file. This way the module can be used to generate placeholder files so password can be sepecified in a different iteration, avoiding them to be put in the module code.
rpm_iteration
Used when installing Grafana from package ('package' or 'repo' install methods) on Red Hat based systems. Defaults to '1'. It should not be necessary to change this in most cases.
service_name
The name of the service managed with the 'archive' and 'package' install methods. Defaults to 'grafana-server'.
version
The version of Grafana to install and manage. Defaults to 'installed'
sysconfig_location
The RPM and DEB packages bring with them the default environment files for the services. The default location of this file for Debian is /etc/default/grafana-server and for RedHat /etc/sysconfig/grafana-server.
sysconfig
A hash of environment variables for the service. This only has an effect for installations with RPM and DEB packages (if install_method is set to 'package' or 'repo').
Example:
sysconfig => {
'http_proxy' => 'http://proxy.example.com',
}
Advanced usage
The archive install method will create the user and a "command line" service by default. There are no extra parameters to manage user/service for archive. However, both check to see if they are defined before defining. This way you can create your own user and service with your own specifications. (sort of overriding) The service can be a bit tricky, in this example below, the class sensu_install::grafana::service creates a startup script and a service{'grafana-server':}
Example:
user { 'grafana':
ensure => present,
uid => '1234',
}
->
class { 'grafana':
install_method => 'archive',
}
include sensu_install::grafana::service
# run your service after install/config but before grafana::service
Class[::grafana::install]
->
Class[sensu_install::grafana::service]
->
Class[::grafana::service]
Using a sub-path for Grafana API
If you are using a sub-path for the Grafana API, you will need to set the grafana_api_path
parameter for the following custom types:
grafana_dashboard
grafana_datasource
grafana_organization
grafana_user
grafana_folder
grafana_team
grafana_membership
grafana_dashboard_permission
For instance, if your sub-path is /grafana
, the grafana_api_path
must
be set to /grafana/api
. Do not add a trailing /
(slash) at the end of the value.
If you are not using sub-paths, you do not need to set this parameter.
Custom Types and Providers
The module includes several custom types:
grafana_organization
In order to use the organization resource, add the following to your manifest:
grafana_organization { 'example_org':
ensure => present,
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
}
grafana_url
, grafana_user
, and grafana_password
are required to create organizations via the API.
set ensure => absent
if you want to remove an organization.
Removing the default organization, (Main org.
), is not supported.
grafana_team
In order to use the team resource, add the following to your manifest:
grafana_team { 'example_team':
ensure => 'present',
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
home_dashboard => 'example_dashboard',
organization => 'example_org',
}
Organziation must exist if specified.
grafana_url
, grafana_user
, and grafana_password
are required to create teams via the API.
ensure
is required. If the resource should be present
or absent
name
is optional if the name will differ from example_team above.
home_dashboard_folder
is optional. Sets the folder where home dashboard resides. Dashboard folder must exist.
home_dashboard
is optional. Sets the home dashboard for team. Dashboard must exist.
organization
is optional. Defaults to Main org.
grafana_dashboard_permission
In order to use the dashboard permission resource, add one the following to your manifest:
add permissions for user:
grafana_dashboard_permission { 'example_user_permission':
ensure => 'present',
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
dashboard => 'example_dashboard',
user => 'example_user',
organization => 'example_org',
}
add permissions for team:
grafana_dashboard_permission { 'example_team_permission':
ensure => 'present',
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
dashboard => 'example_dashboard',
team => 'example_team',
organization => 'example_org',
}
Organziation, team, user and dashboard must exist if specified.
grafana_url
, grafana_user
, and grafana_password
are required to create teams via the API.
ensure
is required. If the resource should be present
or absent
dashboard
is required. The dashboard to set permissions for.
user
is required if team
not set. The user to add permissions for.
team
is required if user
not set. the team to add permissions for.
name
is optional if the name will differ from example_team above.
organization
is optional. Defaults to Main org.
grafana_membership
In order to use the membership resource, add the following to your manifest:
grafana_membership { 'example_membership':
ensure => 'present',
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
membership_type => 'team',
organization => 'example_org',
target_name => 'example_team',
user_name => 'example_user',
role => 'Viewer'
}
}
A membership is the concept of a user belonging to a target - either a team
or an organization
The user and target must both exist for a membership to be created
grafana_url
, grafana_user
, and grafana_password
are required to create memberships via the API.
ensure
is required. If the resource should be present
or absent
membership_type
is required. Either team
or organization
target_name
is required. Specifies the target of the membership.
user_name
is required. Specifies the user that is the focus of the membership.
role
is required. Specifies what rights to grant the user. Either Viewer
, Editor
or Admin
organization
is optional when using the membership_type
of team
. Defaults to Main org.
grafana_dashboard
In order to use the dashboard resource, add the following to your manifest:
grafana_dashboard { 'example_dashboard':
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
grafana_api_path => '/grafana/api',
folder => 'folder-name',
organization => 'NewOrg',
content => template('path/to/exported/file.json'),
}
content
must be valid JSON, and is parsed before imported. You can use the JSON generated with the share/export functionality or from the API call to /dashboards/uid but must remove the fields "id", "uid", "title" and "version" to make the resource call idempotent.
grafana_user
and grafana_password
are optional, and required when
authentication is enabled in Grafana. grafana_api_path
is optional, and only used when using sub-paths for the API. organization
is optional, and used when creating a dashboard for a specific organization.
folder
is an optional parameter, but the folder resource must exist.
Example:
Make sure the grafana-server
service is up and running before creating the grafana_dashboard
definition. One option is to use the http_conn_validator
from the healthcheck module
http_conn_validator { 'grafana-conn-validator' :
host => 'localhost',
port => '3000',
use_ssl => false,
test_url => '/public/img/grafana_icon.svg',
require => Class['grafana'],
}
-> grafana_dashboard { 'example_dashboard':
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
content => template('path/to/exported/file.json'),
}
grafana_datasource
In order to use the datasource resource, add the following to your manifest:
grafana_datasource { 'influxdb':
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
grafana_api_path => '/grafana/api',
type => 'influxdb',
organization => 'NewOrg',
url => 'http://localhost:8086',
user => 'admin',
password => '1nFlux5ecret',
database => 'graphite',
access_mode => 'proxy',
is_default => true,
json_data => template('path/to/additional/config.json'),
secure_json_data => template('path/to/additional/secure/config.json')
}
Available types are: influxdb, elasticsearch, graphite, cloudwatch, mysql, opentsdb, postgres and prometheus
organization
is used to set which organization a datasource will be created on. If this parameter is not set, it will default to organization ID 1 (Main Org. by default). If the default org is deleted, organizations will need to be specified.
Access mode determines how Grafana connects to the datasource, either direct
from the browser, or proxy
to send requests via grafana.
Setting basic_auth
to true
will allow use of the basic_auth_user
and basic_auth_password
params.
Authentication is optional, as are database
and grafana_api_path
; additional json_data
and secure_json_data
can be provided to allow custom configuration options.
Example:
Make sure the grafana-server
service is up and running before creating the grafana_datasource
definition. One option is to use the http_conn_validator
from the healthcheck module
http_conn_validator { 'grafana-conn-validator' :
host => 'localhost',
port => '3000',
use_ssl => false,
test_url => '/public/img/grafana_icon.svg',
require => Class['grafana'],
}
-> grafana_datasource { 'influxdb':
grafana_url => 'http://localhost:3000',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
type => 'influxdb',
url => 'http://localhost:8086',
user => 'admin',
password => '1nFlux5ecret',
database => 'graphite',
access_mode => 'proxy',
is_default => true,
json_data => template('path/to/additional/config.json'),
}
Note that the database
is dynamic, setting things other than "database" for separate types. Ex: for Elasticsearch it will set the Index Name.
jsonData
Settings
Note that there are separate options for json_data / secure_json_data based on the type of datasource you create.
Elasticsearch
esVersion
- Required, either 2 or 5, set as a bare number.
timeField
- Required. By default this is @timestamp, but without setting it in jsonData, the datasource won't work without refreshing it in the GUI.
timeInterval
- Optional. A lower limit for the auto group by time interval. Recommended to be set to write frequency, for example "1m" if your data is written every minute.
Example:
json_data => {"esVersion":5,"timeField":"@timestamp","timeInterval":"1m"}
CloudWatch
authType
- Required. Options are Access & Secret Key
, Credentials File
, or ARN
.
-"keys" = Access & Secret Key
-"credentials" = Credentials File
-"arn" = ARN
When setting authType to credentials
, the database
param will set the Credentials Profile Name.
When setting authType to arn
, another jsonData value of assumeRoleARN
is available, which is not required for other authType settings
customMetricsNamespaces
- Optional. Namespaces of Custom Metrics, separated by commas within double quotes.
defaultRegion
- Required. Options are "ap-northeast-(1 or 2)", "ap-southeast-(1 or 2)", "ap-south-1", "ca-central-1", "cn-north-1", "eu-central-1", "eu-west-(1 or 2)", "sa-east-(1 or 2)", "us-east-(1 or 2)", "us-gov-west-1", "us-west-(1 or 2)".
timeField
Example:
{"authType":"arn","assumeRoleARN":"arn:aws:iam:*","customMetricsNamespaces":"Namespace1,Namespace2","defaultRegion":"us-east-1","timeField":"@timestamp"}
Graphite
graphiteVersion
- Required. Available versions are 0.9
or 1.0
.
tlsAuth
- Set to true
or false
tlsAuthWithCACert
- Set to true
or false
Example:
{"graphiteVersion":"0.9","tlsAuth":true,"tlsAuthWithCACert":false}
OpenTSDB
tsdbResolution
- Required. Options are 1
or 2
.
1
= second
2
= millisecond
tsdbVersion
- Required. Options are 1
, 2
, or 3
.
1
= <=2.1
2
= ==2.2
3
= ==2.3
Example:
{"tsdbResolution:1,"tsdbVersion":3}
InfluxDB
N/A
MySQL
N/A
Prometheus
N/A
grafana_plugin
An example is provided for convenience; for more details, please view the puppet strings docs.
grafana_plugin { 'grafana-simple-json-datasource':
ensure => present,
}
It is possible to specify a custom plugin repository to install a plugin. This will use the --repo option for plugin installation with grafana_cli.
grafana_plugin { 'grafana-simple-json-datasource':
ensure => present,
repo => 'https://nexus.company.com/grafana/plugins',
}
It is also possible to specify a custom plugin url to install a plugin. This will use the --pluginUrl option for plugin installation with grafana_cli.
grafana_plugin { 'grafana-example-custom-plugin':
ensure => present,
plugin_url => 'https://github.com/example/example-custom-plugin/zipball/v1.0.0'
}
grafana_folder
Creates and manages Grafana folders via the API.
The following example creates a folder named 'folder1':
grafana_folder { 'folder1':
ensure => present,
grafana_url => 'http://localhost:3000',
grafana_api_path => '/grafana/api',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
}
grafana_api_path
is only required if using sub-paths for the API
grafana::user
Creates and manages a global grafana user via the API.
grafana_user { 'username':
grafana_url => 'http://localhost:3000',
grafana_api_path => '/grafana/api',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
full_name => 'John Doe',
password => 'Us3r5ecret',
email => 'john@example.com',
organizations => {
'Example Org' => 'Editor',
'Main org.' => 'Viewer',
'Another Org' => 'Admin',
},
}
grafana_api_path
is only required if using sub-paths for the API
If organizations
is specified, the user's organizations will be managed.
These should be specified as a hash of organization names and roles.
If puppet is managing any of these organizations, they will be autorequired.
grafana::notification
Creates and manages a global alert notification channel via the API.
grafana_notification { 'channelname':
grafana_url => 'http://localhost:3000',
grafana_api_path => '/grafana/api',
grafana_user => 'admin',
grafana_password => '5ecretPassw0rd',
name => 'channelname',
type => 'email',
is_default => false,
send_reminder => false,
frequency => '20m',
settings => {
addresses => "alerts@example.com; it@example.com"
}
}
grafana_api_path
is only required if using sub-paths for the API
Notification types and related settingsi (cf doc Grafana : https://github.com/grafana/grafana/blob/master/docs/sources/alerting/notifications.md ) :
- email:
- addresses: "example.com"
- hipchat:
- apikey : "0a0a0a0a0a0a0a0a0a0a0a"
- autoResolve : true
- httpMethod : "POST"
- uploadImage : true
- url : "https://grafana.hipchat.com"
- kafka:
- autoResolve : true
- httpMethod : "POST"
- kafkaRestProxy: "http://localhost:8082"
- kafkaTopic : "topic1"
- uploadImage : true
- LINE:
- autoResolve: true
- httpMethod : "POST"
- token : "token"
- uploadImage: true
- teams (Microsoft Teams):
- autoResolve : true
- httpMethod : "POST"
- uploadImage :true
- url : "http://example.com"
- pagerduty:
- autoResolve : true
- httpMethod : POST
- integrationKey :"0a0a0a0a0a"
- uploadImage : true
- prometheus-alertmanager:
- autoResolve : true
- httpMethod : "POST"
- uploadImage : true
- url : "http://localhost:9093"
- sensu:
- autoResolve : true
- handler : "default",
- httpMethod : "POST"
- uploadImage : true
- url : "http://sensu-api.local:4567/results"
- slack:
- autoResolve : true
- httpMethod : "POST"
- uploadImage : true
- url : "http://slack.com/"
- token : "0a0a0a0a0a0a0a0a0a0a0a"
- threema:
- api_secret : "0a0a0a0a0a0a0a0a0a0a0a"
- autoResolve : true
- gateway_id : "*3MAGWID"
- httpMethod : "POST"
- recipient_id: "YOUR3MID"
- uploadImage : true
- discord:
- autoResolve : true,
- httpMethod : "POST"
- uploadImage : true
- url : "https://example.com"
- webhook:
- autoResolve : true
- httpMethod : "POST"
- uploadImage : false
- url : "http://localhost:8080"
- telegram:
- autoResolve : true
- bottoken : "0a0a0a0a0a0a"
- chatid : "789789789"
- httpMethod : "POST"
- uploadImage : true
Provisioning Grafana
Grafana documentation on provisioning.
This module will provision grafana by placing yaml files into
/etc/grafana/provisioning/datasources
and
/etc/grafana/provisioning/dashboards
by default.
Example datasource
A puppet hash example for Prometheus. The module will place the hash
as a yaml file into /etc/gafana/provisioning/datasources/puppetprovisioned.yaml
.
class { 'grafana':
provisioning_datasources => {
apiVersion => 1,
datasources => [
{
name => 'Prometheus',
type => 'prometheus',
access => 'proxy',
url => 'http://localhost:9090/prometheus',
isDefault => true,
},
],
}
}
Here is the same configuration example as a hiera hash.
grafana::provisioning_datasources:
apiVersion: 1
datasources:
- name: 'Prometheus'
type: 'prometheus'
access: 'proxy'
url: 'http://localhost:9090/prometheus'
isDefault: true
Example dashboard
An example puppet hash for provisioning dashboards. The module will
place the hash as a yaml file into
/etc/grafana/provisioning/dashboards/puppetprovisioned.yaml
by default. More details follow the examples.
class { 'grafana':
provisioning_dashboards => {
apiVersion => 1,
providers => [
{
name => 'default',
orgId => 1,
folder => '',
type => 'file',
disableDeletion => true,
options => {
path => '/var/lib/grafana/dashboards',
puppetsource => 'puppet:///modules/my_custom_module/dashboards',
},
},
],
}
}
Here is the same configuraiton example as a hiera hash.
grafana::provisioning_dashboards:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: true
options:
path: '/var/lib/grafana/dashboards'
puppetsource: 'puppet:///modules/my_custom_module/dashboards'
In both examples above a non-grafana option named puppetsource
has
been used. When this module finds that the provisioning_dashboards hash
contains keys path
and puppetsource
in the options
subhash, it
will do the following.
- It will create the path found in
options['path']
. Note: puppet will only create the final directory of the path unless the parametercreate_subdirs_provisioning
is set to true: this defaults to false. - It will use
puppetsource
as the file resource's 'source' for the directory. - It removes the
puppetsource
key from theoptions
subhash, so the subsequent yaml file for gafana does not contain this key. (Thepath
key will remain.)
This feature allows you to define a custom module, and place any
dashboards you want provisioned in the its files/
directory. In the
example above you would put dashboards into
my_custom_module/files/dashboards
and puppet-grafana will create
/var/lib/grafana/dashboards
and provision it with the contents of
my_custom_module/files/dashboards
.
Puppet's file resource may also be given a file://
URI which may
point to a locally available directory on the filesystem, typically
the filesystem of the puppetserver/master. Thus you may specify a
local directory with grafana dashboards you wish to provision into
grafana.
Provisioning with dashboards from grafana.com
GrafanaLabs provides lots of dashboards that may be reused. Those ones are not directly usable for provisioning (this is a Grafana issue, not a Puppet one).
In order to have a "provisionable" dashboard in JSON format, you have to prepare it before adding it in your Puppet code. Here are the steps to follow:
- Use a Grafana instance
- Import the desired dashboard
- Define its datasource
- From the dashboard view:
- Click the "Share dashboard" icon (top left corner of screen)
- Select the "Export" tab,
- Activate "Export for sharing externally"
- Click "Save to file"
- In the JSON file:
- Remove the keys
__imports
and__requires
- Replace all
${DS_PROMETHEUS}
by your datasource name
- Remove the keys
- Once saved, you may place this JSON file in your
puppet:///modules/my_custom_module/dashboards
directory
Note:
This procedure have been tested with Grafana 6.x. It may not work for any dashboard, depending on how it's been coded.
Dashboards known to be "provisionable":
Dashboards known not to be "provisionable":
Tasks
change_grafana_admin_password
old_password
: the old admin password
new_password
: the password you want to use for the admin user
uri
: http
or https
port
: the port Grafana runs on locally
This task can be used to change the password for the admin user in grafana
Limitations
This module has been tested on every operating system in the metadata.json, using each of the 'archive', 'docker' and 'package' installation methods. Other configurations should work with minimal, if any, additional effort.
Development
This module is a fork of bfraser/grafana maintained by Vox Pupuli. Vox Pupuli welcomes new contributions to this module, especially those that include documentation and rspec tests. We are happy to provide guidance if necessary.
Please see CONTRIBUTING for more details.
Authors
- Bill Fraser fraser@pythian.com
- Vox Pupuli Team
Copyright and License
Copyright (C) 2015 Bill Fraser
Bill can be contacted at: fraser@pythian.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Reference
Table of Contents
Classes
Public Classes
grafana
: Installs and configures Grafana.grafana::validator
: Manage grafana_conn_validator resource
Private Classes
grafana::config
: Manage grafana configurationgrafana::install
: Manage grafana installationgrafana::service
: Manage grafana service
Resource types
grafana_conn_validator
: Verify connectivity to the Grafana APIgrafana_dashboard
: Manage dashboards in Grafanagrafana_dashboard_permission
: Manage dashboard permissions in Grafanagrafana_datasource
: Manage datasources in Grafanagrafana_folder
: Manage folders in Grafanagrafana_ldap_config
: Manage Grafana LDAP configurationgrafana_ldap_group_mapping
: Map an LDAP group to a Grafana role.grafana_ldap_server
: Manage Grafana LDAP servers for LDAP authentication.grafana_membership
: Manage resource memberships in Grafanagrafana_notification
: Manage notification in Grafanagrafana_organization
: Manage organizations in Grafanagrafana_plugin
: manages grafana pluginsgrafana_team
: Manage teams in Grafanagrafana_user
: Manage users in Grafana
Functions
grafana::deep_find_and_remove
: == Function: deep_find_and_remove This function takes a hash as input, along with a string (key). Additionally, the optional removekey (defagrafana::get_sub_paths
: == Function get_sub_paths This function receives an input path as an input parameter, and returns an array of the subpaths in the input, exc
Tasks
change_grafana_admin_password
: Change the Grafana admin user's password
Classes
grafana
Installs and configures Grafana.
Examples
Using the Class
class { 'grafana':
install_method => 'docker',
}
Parameters
The following parameters are available in the grafana
class:
archive_source
cfg_location
ldap_cfg
container_cfg
container_params
data_dir
install_dir
install_method
manage_package_repo
package_name
package_source
service_name
version
repo_name
repo_gpg_key_url
repo_key_id
repo_release
repo_url
plugins
provisioning_dir
provisioning_dashboards
provisioning_datasources
provisioning_dashboards_file
provisioning_datasources_file
create_subdirs_provisioning
sysconfig_location
sysconfig
ldap_servers
ldap_group_mappings
toml_manage_package
toml_package_name
toml_package_ensure
toml_package_provider
docker_image
docker_ports
rpm_iteration
cfg
archive_source
Data type: Optional[String]
Download location of tarball to be used with the 'archive' install method.
Default value: undef
cfg_location
Data type: String
Location of the configuration file.
ldap_cfg
Data type: Optional[Variant[Hash,Array[Hash],Sensitive[Hash],Sensitive[Array[Hash]]]]
Default value: undef
container_cfg
Data type: Boolean
Determines whether a configuration file should be generated when using the 'docker' install method.
If true, use the cfg
and cfg_location
parameters to control creation of the file.
Default value: false
container_params
Data type: Hash
Parameters to use when creating the Docker container. For use with the 'docker' install method.
Refer to documentation of the docker::run
resource in the garethr-docker
module for details of available parameters.
Default value: {}
data_dir
Data type: String
The directory Grafana will use for storing its data.
Default value: '/var/lib/grafana'
install_dir
Data type: String
Installation directory to be used with the 'archive' install method.
Default value: '/usr/share/grafana'
install_method
Data type: Enum['archive', 'docker', 'package', 'repo']
Set to 'archive' to install Grafana using the tar archive. Set to 'docker' to install Grafana using the official Docker container. Set to 'package' to install Grafana using .deb or .rpm packages. Set to 'repo' to install Grafana using an apt or yum repository.
manage_package_repo
Data type: Boolean
If true this will setup the official grafana repositories on your host.
package_name
Data type: String
The name of the package managed with the 'package' install method.
package_source
Data type: Optional[String]
Download location of package to be used with the 'package' install method.
Default value: undef
service_name
Data type: String
The name of the service managed with the 'archive' and 'package' install methods.
version
Data type: String
The version of Grafana to install and manage.
Default value: 'installed'
repo_name
Data type: Enum['stable', 'beta', 'custom']
When using 'repo' install_method, the repo to look for packages in. Set to 'stable' to install only stable versions Set to 'beta' to install beta versions Set to 'custom' to install from custom repo. Use full URL
Default value: 'stable'
repo_gpg_key_url
Data type: Stdlib::HTTPUrl
When using 'repo' install_method, the repo_gpg_key_url to look for the gpg signing key of the repo.
Default value: 'https://packages.grafana.com/gpg.key'
repo_key_id
Data type: String[1]
When using 'repo' install_method, the repo_key_id of the repo_gpg_key_url key on Debian based systems.
Default value: 'B53AE77BADB630A683046005963FA27710458545'
repo_release
Data type: Optional[String[1]]
Optional value, needed on Debian based systems. If repo name is set to custom, used to identify the release of the repo. No default value.
Default value: undef
repo_url
Data type: Optional[Stdlib::HTTPUrl]
When using 'repo' install_method, the repo_url to look for packages in. Set to a custom string value to install from a custom repo.
plugins
Data type: Hash
Plugins to be passed to create_resources
, wraps around the
grafana_plugin
resource.
Default value: {}
provisioning_dir
Data type: Stdlib::Absolutepath
Path to the grafana provisioning dir e.g /etc/grafana/provisioning
Default value: '/etc/grafana/provisioning'
provisioning_dashboards
Data type: Hash
Dashboards to provision into grafana. grafana > v5.0.0 required. Will be converted into YAML and used by grafana to provision dashboards.
Default value: {}
provisioning_datasources
Data type: Hash
Datasources to provision into grafana, grafana > v5.0.0 required. Will be converted into YAML and used by granfana to configure datasources.
Default value: {}
provisioning_dashboards_file
Data type: Stdlib::Absolutepath
Fully qualified path to place the provisioning file for dashboards, only used if provisioning_dashboards is specified.
Default value: "${provisioning_dir}/dashboards/puppetprovisioned.yaml"
provisioning_datasources_file
Data type: Stdlib::Absolutepath
Fully qualified path to place the provisioning file for datasources, only used if provisioning_datasources is specified.
Default value: "${provisioning_dir}/datasources/puppetprovisioned.yaml"
create_subdirs_provisioning
Data type: Boolean
If true puppet will create any subdirectories in the given path when provisioning dashboards.
Default value: false
sysconfig_location
Data type: Optional[String]
Location of the sysconfig file for the environment of the grafana-server service. This is only used when the install_method is 'package' or 'repo'.
sysconfig
Data type: Optional[Hash]
Environment variables for the grafana-server service
Example: sysconfig => { 'http_proxy' => 'http://proxy.example.com/' }
Default value: undef
ldap_servers
Data type: Hash[String[1], Hash]
Servers to be passed to create_resources
, wraps around the
grafana_ldap_server
resource.
Default value: {}
ldap_group_mappings
Data type: Hash[String[1], Hash]
ldap_group_mappings
Mappings to be passed to create_resources
, wraps around the
grafana_ldap_group_mapping
resource.
Default value: {}
toml_manage_package
Data type: Boolean
ruby-toml is required to generate the TOML-based LDAP config for Grafana. Set to false if you manage package- or gem-install somewhere else.
Default value: true
toml_package_name
Data type: String[1]
Name of the software-package providing the TOML parser library.
Default value: 'ruby-toml'
toml_package_ensure
Data type: String[1]
Ensure the package-resource - e.g. installed, absent, etc. https://puppet.com/docs/puppet/latest/types/package.html#package-attribute-ensure
Default value: 'present'
toml_package_provider
Data type: Optional[String[1]]
The package-provider used to install the TOML parser library.
Default value: undef
docker_image
Data type: String
name of the docker image that provides grafana
Default value: 'grafana/grafana'
docker_ports
Data type: String
ports docker should expose
Default value: '3000:3000'
rpm_iteration
Data type: String
explicit Iteration / epoch for the rpm
Default value: '1'
cfg
Data type: Variant[Hash,Sensitive[Hash]]
The whole grafana configuration
Default value: {}
grafana::validator
Manage grafana_conn_validator resource
Parameters
The following parameters are available in the grafana::validator
class:
grafana_url
Data type: Stdlib::HTTPUrl
Grafana URL.
Default value: 'http://localhost:3000'
grafana_api_path
Data type: Stdlib::Absolutepath
API path to validate with.
Default value: '/api/health'
Resource types
grafana_conn_validator
Verify connectivity to the Grafana API
Properties
The following properties are available in the grafana_conn_validator
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the grafana_conn_validator
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api/health
grafana_url
The URL of the Grafana server
Default value: http://localhost:3000
name
namevar
Arbitrary name of this resource
provider
The specific backend to use for this grafana_conn_validator
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.
timeout
How long to wait for the API to be available
Default value: 20
grafana_dashboard
Manage dashboards in Grafana
Properties
The following properties are available in the grafana_dashboard
type.
content
The JSON representation of the dashboard.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the grafana_dashboard
type.
folder
The folder to place the dashboard in (optional)
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server (optional)
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server (optional)
organization
The organization name to create the datasource on
Default value: 1
provider
The specific backend to use for this grafana_dashboard
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
title
The title of the dashboard.
grafana_dashboard_permission
Manage dashboard permissions in Grafana
Properties
The following properties are available in the grafana_dashboard_permission
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
permission
Valid values: Admin
, Edit
, View
The role to apply
Parameters
The following parameters are available in the grafana_dashboard_permission
type.
dashboard
grafana_api_path
grafana_password
grafana_url
grafana_user
name
organization
provider
team
user
dashboard
Dashboard to modify permissions for
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The name of the permission.
organization
The name of the organization to add permission for
Default value: Main Org.
provider
The specific backend to use for this grafana_dashboard_permission
resource. You will seldom need to specify this ---
Puppet will usually discover the appropriate provider for your platform.
team
Team to add the permission for
user
User to add the permission for
grafana_datasource
Manage datasources in Grafana
Properties
The following properties are available in the grafana_datasource
type.
access_mode
Valid values: direct
, proxy
Whether the datasource is accessed directly or not by the clients
basic_auth
Valid values: true
, false
Whether basic auth is enabled or not
basic_auth_password
The password for basic auth if enabled
basic_auth_user
The username for basic auth if enabled
database
The name of the database (optional)
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
is_default
Valid values: true
, false
Whether the datasource is the default one
json_data
Additional JSON data to configure the datasource (optional)
password
The password for the datasource (optional)
secure_json_data
Additional secure JSON data to configure the datasource (optional)
type
The datasource type
uid
An optional unique identifier for the datasource. Supported by grafana 7.3 onwards. If you do not specify this parameter, grafana will assign a uid for you
url
The URL/Endpoint of the datasource
user
The username for the datasource (optional)
with_credentials
Valid values: true
, false
Whether credentials such as cookies or auth headers should be sent with cross-site requests
Parameters
The following parameters are available in the grafana_datasource
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The name of the datasource.
organization
The organization name to create the datasource on
Default value: 1
provider
The specific backend to use for this grafana_datasource
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
grafana_folder
Manage folders in Grafana
Properties
The following properties are available in the grafana_folder
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
permissions
The permissions of the folder
Parameters
The following parameters are available in the grafana_folder
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server (optional)
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server (optional)
organization
The organization name to create the folder on
Default value: 1
provider
The specific backend to use for this grafana_folder
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
title
The title of the folder
uid
UID of the folder
grafana_ldap_config
Manage Grafana LDAP configuration
Parameters
The following parameters are available in the grafana_ldap_config
type.
backup
Valid values: true
, false
, yes
, no
Backup existing files before replacing them into the file-bucket
Default value: false
group
Group of the LDAP configuration file either as String or Integer (default: grafana)
Default value: grafana
mode
File-permissions mode of the LDAP configuration file as String
Default value: 0440
owner
Owner of the LDAP configuration-file either as String or Integer (default: root)
Default value: root
replace
Valid values: true
, false
, yes
, no
Replace existing files
Default value: true
title
Path to ldap.toml
validate_cmd
A command to validate the new Grafana LDAP configuration before actually replacing it
grafana_ldap_group_mapping
Map an LDAP group to a Grafana role.
Parameters
The following parameters are available in the grafana_ldap_group_mapping
type.
grafana_admin
Valid values: true
, false
, yes
, no
Additonal flag for Grafana > v5.3 to signal admin-role to Grafana
Default value: false
group_dn
The LDAP distinguished-name of the group
ldap_server_name
The LDAP server config to apply the group-mappings on
org_role
Valid values: Admin
, Editor
, Viewer
The Grafana role the shall be assigned to this group
title
A unique identifier of the resource
grafana_ldap_server
Manage Grafana LDAP servers for LDAP authentication.
Parameters
The following parameters are available in the grafana_ldap_server
type.
attributes
bind_dn
bind_password
client_cert
client_key
group_search_base_dns
group_search_filter
group_search_filter_user_attribute
hosts
port
root_ca_cert
search_base_dns
search_filter
ssl_skip_verify
start_tls
title
use_ssl
attributes
Mapping LDAP attributes to their Grafana user-account-properties (optional)
bind_dn
If the LDAP server requires authentication (i.e. non-anonymous), provide the distinguished-name (dn) here (optional)
bind_password
If the LDAP server requires authentication (i.e. non-anonymous), provide the password (optional)
client_cert
If the LDAP server requires certificate-based authentication, specify the client's certificate (for TLS and SSL, optional)
client_key
If the LDAP server requires certificate-based authentication, specify the client's certificate (for TLS and SSL, optional)
group_search_base_dns
The base-dn to be used when querying LDAP for group-accounts (optional)
group_search_filter
A search-filter to be used when querying LDAP for group-accounts (optional)
group_search_filter_user_attribute
The attribute to be used to locate matching user-accounts in the group (optional)
hosts
The servers to perform LDAP authentication at
port
The port to connect at the LDAP servers (389 for TLS/plaintext, 636 for SSL [ldaps], optional)
Default value: 389
root_ca_cert
The root ca-certificate to verify the LDAP server's SSL certificate against (for TLS and SSL, optional)
Default value: /etc/ssl/certs/ca-certificates.crt
search_base_dns
The one or more base-dn to be used when querying LDAP for user-accounts (optional)
Default value: []
search_filter
A search-filter to be used when querying LDAP for user-accounts (optional)
ssl_skip_verify
Valid values: true
, false
, yes
, no
Set to true to disable verification of the LDAP server's SSL certificate (for TLS and SSL, optional)
Default value: false
start_tls
Valid values: true
, false
, yes
, no
Set to true if you want to perform LDAP via a TLS-connection (not meant to be for SSL, optional)
Default value: true
title
A unique identified for this LDAP server.
use_ssl
Valid values: true
, false
, yes
, no
Set to true if you want to perform LDAP via a SSL-connection (not meant to be for TLS, optional)
Default value: false
grafana_membership
Manage resource memberships in Grafana
Properties
The following properties are available in the grafana_membership
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
role
Valid values: Admin
, Editor
, Viewer
The role to apply to the membership (Admin, Editor, Viewer)
Parameters
The following parameters are available in the grafana_membership
type.
grafana_api_path
grafana_password
grafana_url
grafana_user
membership_type
name
organization
provider
target_name
user_name
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
membership_type
Valid values: organization
, team
The underlying type of the membership (organization, team)
name
namevar
The name of the membership.
organization
The name of the organization to add membership for (team only)
Default value: Main Org.
provider
The specific backend to use for this grafana_membership
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
target_name
The name of the target to add membership for
user_name
The name of the user to add membership for
grafana_notification
Manage notification in Grafana
Properties
The following properties are available in the grafana_notification
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
frequency
The notification reminder frequency
is_default
Valid values: true
, false
Whether the notification is the default one
Default value: false
send_reminder
Valid values: true
, false
Whether automatic message resending is enabled or not
Default value: false
settings
Additional JSON data to configure the notification
type
The notification type
Parameters
The following parameters are available in the grafana_notification
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The name of the notification.
provider
The specific backend to use for this grafana_notification
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.
grafana_organization
Manage organizations in Grafana
Properties
The following properties are available in the grafana_organization
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the grafana_organization
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The name of the organization.
provider
The specific backend to use for this grafana_organization
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.
grafana_plugin
manages grafana plugins
Examples
Install a grafana plugin
grafana_plugin { 'grafana-simple-json-datasource': }
Install a grafana plugin from different repo
grafana_plugin { 'grafana-simple-json-datasource':
ensure => 'present',
repo => 'https://nexus.company.com/grafana/plugins',
}
Install a grafana plugin from a plugin url
grafana_plugin { 'grafana-example-custom-plugin':
ensure => 'present',
plugin_url => 'https://github.com/example/example-custom-plugin/zipball/v1.0.0'
}
Uninstall a grafana plugin
grafana_plugin { 'grafana-simple-json-datasource':
ensure => 'absent',
}
Show resources
$ puppet resource grafana_plugin
Properties
The following properties are available in the grafana_plugin
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Parameters
The following parameters are available in the grafana_plugin
type.
name
Valid values: %r{^\S+$}
namevar
The name of the plugin to enable
plugin_url
Full url to the plugin zip file
provider
The specific backend to use for this grafana_plugin
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
repo
The URL of an internal plugin server
grafana_team
Manage teams in Grafana
Properties
The following properties are available in the grafana_team
type.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
home_dashboard
The id or name of the home dashboard
Default value: Default
home_dashboard_folder
The UID or name of the home dashboard folder
theme
The theme to use for the team
timezone
The timezone to use for the team
Parameters
The following parameters are available in the grafana_team
type.
email
The email for the team
Default value: ''
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The name of the team
organization
The organization the team belongs to
Default value: Main Org.
provider
The specific backend to use for this grafana_team
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
grafana_user
Manage users in Grafana
Properties
The following properties are available in the grafana_user
type.
email
The email for the user
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
full_name
The full name of the user.
is_admin
Valid values: true
, false
Whether the user is a grafana admin
organizations
A hash of organizations and roles
password
The password for the user
theme
The theme for the user
Parameters
The following parameters are available in the grafana_user
type.
grafana_api_path
The absolute path to the API endpoint
Default value: /api
grafana_password
The password for the Grafana server
grafana_url
The URL of the Grafana server
Default value: ''
grafana_user
The username for the Grafana server
name
namevar
The username of the user.
provider
The specific backend to use for this grafana_user
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
Functions
grafana::deep_find_and_remove
Type: Ruby 4.x API
== Function: deep_find_and_remove
This function takes a hash as input, along with a string (key). Additionally, the optional removekey (defaults to 'puppetsource') is a parameter.
The purpose of this function is to extract the 'options' subhash from the array of hashes given to provision dashboards. This options subhash may contain a path and source which puppet will use for provisioning: creating the path and applying the files from the source.
Additionally, if the key 'puppetsource' exists in the sub-hash, it will be deleted from the structure. Thus the output of this function may be used in yaml format for grafana's provisioning configuration file for dashboards.
grafana::deep_find_and_remove(String $key, Hash $object, Optional[String] $removekey)
== Function: deep_find_and_remove
This function takes a hash as input, along with a string (key). Additionally, the optional removekey (defaults to 'puppetsource') is a parameter.
The purpose of this function is to extract the 'options' subhash from the array of hashes given to provision dashboards. This options subhash may contain a path and source which puppet will use for provisioning: creating the path and applying the files from the source.
Additionally, if the key 'puppetsource' exists in the sub-hash, it will be deleted from the structure. Thus the output of this function may be used in yaml format for grafana's provisioning configuration file for dashboards.
Returns: Array
key
Data type: String
object
Data type: Hash
removekey
Data type: Optional[String]
grafana::get_sub_paths
Type: Ruby 4.x API
== Function get_sub_paths
This function receives an input path as an input parameter, and returns an array of the subpaths in the input, excluding the input path itself. The function will attempt to ignore any extra slashes in the path given.
This function will only work on UNIX paths with forward slashes (/).
Examples: input = '/var/lib/grafana/dashboards' output = [ '/var', '/var/lib', '/var/lib/grafana'/ ]
input = '/opt' output = []
input = '/first/second/' output = [ '/first' ]
grafana::get_sub_paths(String $inputpath)
== Function get_sub_paths
This function receives an input path as an input parameter, and returns an array of the subpaths in the input, excluding the input path itself. The function will attempt to ignore any extra slashes in the path given.
This function will only work on UNIX paths with forward slashes (/).
Examples: input = '/var/lib/grafana/dashboards' output = [ '/var', '/var/lib', '/var/lib/grafana'/ ]
input = '/opt' output = []
input = '/first/second/' output = [ '/first' ]
Returns: Array
inputpath
Data type: String
Tasks
change_grafana_admin_password
Change the Grafana admin user's password
Supports noop? false
Parameters
old_password
Data type: Optional[String[1]]
The old admin password
new_password
Data type: Optional[String[1]]
The new admin password
uri
Data type: Enum['http','https']
http or https
port
Data type: Integer
The port Grafana is running on
What are tasks?
Modules can contain tasks that take action outside of a desired state managed by Puppet. It’s perfect for troubleshooting or deploying one-off changes, distributing scripts to run across your infrastructure, or automating changes that need to happen in a particular order as part of an application deployment.
Tasks in this module release
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v14.1.0 (2024-06-20)
Implemented enhancements:
v14.0.0 (2024-06-14)
Breaking changes:
- Drop support for EoL Grafana 8 & 9 #361 (bastelfreak)
- Drop EoL RedHat 7, CentOS 7 & 8 support #359 (bastelfreak)
- Drop EoL Ubuntu 18.04 support #358 (bastelfreak)
- Drop EoL Debian 10 support #357 (bastelfreak)
Implemented enhancements:
- Add Grafana 11 as supported version #355 (sebastianrakel)
- Add Debian 12 support #341 (bastelfreak)
Fixed bugs:
- Create subpaths for provisioning_datasources #362 (sebastianrakel)
Merged pull requests:
- CI: Enhance cleanup script #363 (bastelfreak)
- CI: Run on latest grafana patch versions #360 (bastelfreak)
- Use modern apt keyrings #351 (saz)
v13.2.0 (2024-05-24)
Implemented enhancements:
Fixed bugs:
v13.1.0 (2023-10-31)
Implemented enhancements:
- Add OracleLinux support #340 (bastelfreak)
v13.0.1 (2023-09-15)
Fixed bugs:
- Update Debian repo signing key #335 (mouchymouchy)
v13.0.0 (2023-06-22)
Breaking changes:
- puppetlabs/stdlib: Require 9.x #325 (bastelfreak)
Implemented enhancements:
- Add Ubuntu 22.04 support #329 (bastelfreak)
- Add EL9 support #328 (bastelfreak)
Merged pull requests:
- cleanup .fixtures.yml #326 (bastelfreak)
v12.0.0 (2023-06-14)
Breaking changes:
- puppet/archive: Allow 7.x; puppetlabs/stdlib: Require 9.x #322 (bastelfreak)
- Drop Puppet 6 support #320 (bastelfreak)
v11.2.0 (2023-03-30)
Implemented enhancements:
- Add AlmaLinux 8 support #312 (bastelfreak)
- Add Rocky 8 support #311 (bastelfreak)
Fixed bugs:
Closed issues:
- repository setup: new GPG repository keys #307
- Failure to install Grafana using module on fresh install of Debian 11 #278
Merged pull requests:
- Disable beta packages tests on Debian #316 (smortex)
- Update repo urls #314 (promasu)
- Move static default settings from Hiera to Puppet #309 (smortex)
v11.1.0 (2022-11-02)
Implemented enhancements:
- Refactor
grafana_datasource
and adduid
property #301 (alexjfisher)
Fixed bugs:
Closed issues:
grafana_folder
permissions
not idempotent #304- 'uid' property is not included in datasource provisioning #229
Merged pull requests:
v11.0.0 (2022-08-17)
Breaking changes:
- Disable Arch Linux testing #292 (bastelfreak)
- Remove
address
param fromgrafana_organization
#284 (alexjfisher)
Implemented enhancements:
- Switch documentation to puppet strings #294 (SimonHoenscheid)
- Add support for custom repository URL #291 (SimonHoenscheid)
- Add
organizations
property tografana_user
#286 (alexjfisher) - Fix performance of
grafana_user
#285 (alexjfisher) - Accept
Sensitive
ldap_cfg
#282 (alexjfisher) - Accept
Sensitive
cfg
#280 (alexjfisher)
Fixed bugs:
- Fix
grafana_user
and switch to usingflush
#283 (alexjfisher) - Set grafana.ini owner to root with packages #264 (ekohl)
Merged pull requests:
- Remove outdated
Integer note
from README #281 (alexjfisher)
v10.0.1 (2021-12-02)
Fixed bugs:
- Grafana_datasource no longer idempotent #270
- Add support for HTTP operation PATCH to fix grafana_membership #266 (dgoetz)
Merged pull requests:
- Fix rubocop after disabling BooleanSymbol cop #271 (root-expert)
- Correct type for the example #265 (earthgecko)
v10.0.0 (2021-11-26)
Breaking changes:
Implemented enhancements:
Fixed bugs:
Closed issues:
- grafana_dashboards ov version 9.0.1 does not work with Grafana 6.7.6 #261
v9.0.1 (2021-08-26)
Merged pull requests:
v9.0.0 (2021-08-17)
Breaking changes:
- Support only 6.x/7.x/8.x versions #246 (root-expert)
- bump default grafana version for FreeBSD #240 (olevole)
Implemented enhancements:
- puppetlabs/stdlib: Allow 7.x #244 (bastelfreak)
- puppet/archive: allow 5.x #243 (bastelfreak)
- Allow grafana_team home dashboard to be scoped to a folder #241 (treydock)
Closed issues:
- config class does not restart service #239
- grafana_team resource gives Could not evaluate: Invalid parameter #237
Merged pull requests:
- Update README.md about tested OSes #250 (bastelfreak)
- Use Iterable.find to find a folder #249 (ekohl)
- Add Ubuntu 20.04 support #248 (root-expert)
- Update badges in README.md #245 (bastelfreak)
v8.0.0 (2021-02-20)
Breaking changes:
- Drop EoL Debian 8 support #233 (bastelfreak)
- Drop Eol CentOS 6 support #232 (bastelfreak)
- Mask/redact password and secure_json_data in grafana_datasource; require at least puppet 6.1.0 #221 (nmaludy)
Implemented enhancements:
- Enable Puppet 7 support #234 (bastelfreak)
- Allow multiple puppetsource #224 (jsfrerot)
Fixed bugs:
- Fix
puppet generate types
#227 (smortex) - Ensure all API types have grafana_conn_validator autorequires #226 (treydock)
- Don't manage dashboard path when puppetsource is not set #225 (treydock)
Closed issues:
- Feature Request: Support for Grafana Plugin install by URL #173
- add/change sourceselect option for provisioning_dashboards #130
Merged pull requests:
- Fix types to work with 'puppet generate types' #236 (treydock)
- Rebase plugin from zip patch #235 (XMol)
- Bugfix for teams, update README and acceptance testing #215 (MorningLightMountain713)
v7.0.0 (2020-08-24)
v6.2.0 (2020-08-23)
Breaking changes:
- drop Ubuntu 14.04 support #192 (bastelfreak)
Implemented enhancements:
- add SLES support #220 (tuxmea)
- Support for teams, dashboard permissions and memberships #210 (MorningLightMountain713)
- Add mechanism to make API changes once API is available #208 (treydock)
- Update list of supported operating systems #204 (dhoppe)
- allow connecting to multiple LDAP services #199 (unki)
Fixed bugs:
- Code in maifests/service.pp refers to code from manifests/params.pp #206
- Grafana 5.0.3 Users passwords being set and datasources created on every puppet run #104
- Clean up code, because params.pp has been removed #214 (dhoppe)
Closed issues:
- Grafana folder example doc update #197
Merged pull requests:
- Fix
grafana_user
password
idempotency #211 (alexjfisher) - Support managing folder permissions #207 (treydock)
- #197 Minor Doc correction - grafana_folder #198 (RandellP)
- Do not restart grafana on provisioned dashboard updates #196 (treydock)
- Remove duplicate CONTRIBUTING.md file #193 (dhoppe)
v6.1.0 (2019-10-30)
Implemented enhancements:
- Feature request: add basicAuth for grafana_datasource #43
- Add FreeBSD 12 support #179 (olevole)
- Update grafana_dashboard resource for folders #172 (alexconrey)
- Implement grafana_folder resource type #170 (alexconrey)
- Mark passwords as sensitive #165 (alexjfisher)
Fixed bugs:
- Fix version, because 6.0.0-beta1 does not exist anymore #163 (dhoppe)
- Fix value of variables base_url and real_archive_source #161 (dhoppe)
- Fix value of variable real_package_source #160 (dhoppe)
Closed issues:
- How to create Notification channels #188
- Cannot install puppet/grafana, most recent puppet/archive version is v4.2 #184
- [UBUNTU 14.04] Package not found #85
- Puppet module exposes passwords - current and previous in plane text during puppet runs #82
- using docker install with container_cfg attempts to use incorrect permissions #52
- Hide sensitive data values #45
- Feature request: support auth.proxy config option #40
Merged pull requests:
- Clean up acceptance spec helper #189 (ekohl)
- DOC Add Provisioning with dashboards from grafana.com #185 (mfaure)
- Allow puppet/archive 4.x and puppetlabs/stdlib 6.x #176 (alexjfisher)
- Corrected invalid database config example #169 (Rovanion)
- Use data in modules instead of params.pp #167 (dhoppe)
- Remove Puppet 3 specific syntax #166 (dhoppe)
v6.0.0 (2019-02-14)
Breaking changes:
- modulesync 2.5.1 and drop Puppet 4 #154 (bastelfreak)
Implemented enhancements:
- Add a task for setting the admin user's password #148 (genebean)
- Integration notification channels #144 (jnguiot)
Fixed bugs:
- Update repo_name Enum for new 'beta' repo #155 (JayH5)
- Fix #152 : multi arch send out a notice #153 (elfranne)
- fixes repo url and key #150 (crazymind1337)
Closed issues:
- multi arch send out a notice #152
- Package Repo moved to packages.grafana.com #149
- install_mode archive fails if $data_dir is not manually created #142
Merged pull requests:
- include classes without leading :: #157 (bastelfreak)
- replace deprecated has_key() with
in
#147 (bastelfreak) - archive install_method creates data_dir #143 (othalla)
- Fix folder typos #140 (pfree)
v5.0.0 (2018-10-06)
Breaking changes:
Implemented enhancements:
- removing value restriction on grafana_datasource so any custom plugin can be used #136 (lukebigum)
- add --repo option to grafana_cli plugin install #132 (rwuest)
- Parametrize provisioning file names #128 (kazeborja)
Closed issues:
- Version parameter should default to 'installed' #125
Merged pull requests:
- modulesync 2.1.0 and allow puppet 6.x #137 (bastelfreak)
- allow puppetlabs/stdlib 5.x and puppetlabs/apt 6.x #134 (bastelfreak)
v4.5.0 (2018-07-16)
Implemented enhancements:
- Use provisioning backend for dashboards, providers #103
- Feature: Add grafana provisioning to this module. #120 (drshawnkwang)
Closed issues:
- Any plan to update module to use the grafana provisioning by yaml files ? #122
v4.4.1 (2018-07-04)
Fixed bugs:
- Fix dependency in provisioning plugins #118 (drshawnkwang)
Closed issues:
- grafana plugin install/check breaks catalog run when grafana-server service is not running #79
v4.4.0 (2018-06-21)
Implemented enhancements:
- Manage sysconfig files #115 (ZeroPointEnergy)
Merged pull requests:
- bump archive upper version boundary to \<4.0.0 #116 (bastelfreak)
v4.3.0 (2018-06-18)
Implemented enhancements:
Fixed bugs:
- Update release codename from jessie to stretch. #113 (drshawnkwang)
Closed issues:
- puppet-grafana Debian repository should use codename stretch #112
Merged pull requests:
- drop EOL OSs; fix puppet version range #109 (bastelfreak)
- Rely on beaker-hostgenerator for docker nodesets #108 (ekohl)
- switch from topscope facts to $facts hash #102 (bastelfreak)
- Update README.md #99 (cclloyd)
v4.2.0 (2018-03-06)
Implemented enhancements:
- Create organization #71
- Expand organization property for dashboards #94 (brandonrdn)
- Add grafana_api_path to allow for API sub-paths #93 (brandonrdn)
v4.1.1 (2018-02-21)
Fixed bugs:
- grafana_datasource provider with_credentials() returns is_default value #89
- fix datasource provider error #90 (brandonrdn)
v4.1.0 (2018-02-03)
Implemented enhancements:
- (SIMP-4206) Added organization provider and updated datasource provider #86 (heliocentric)
Closed issues:
- "Could not autoload" error in grafana_dashboard with ruby 2.4 on Centos 6 #83
v4.0.3 (2017-12-09)
Closed issues:
- Apt key add gets called every run #77
- Getting rid or changing the url check for grafana datasource url's #75
Merged pull requests:
- Update readme with examples of using datasource and dashboard #80 (devcfgc)
- Removing the datasource url check as it leads to errors with postgres… #76 (Faffnir)
v4.0.2 (2017-10-12)
Implemented enhancements:
- bump archive upper boundary to work with latest versions #73 (bastelfreak)
- add debian 8 and 9 support #72 (bastelfreak)
Merged pull requests:
v4.0.1 (2017-09-22)
Fixed bugs:
- Module doesn't work on Ubuntu Xenial #56
v4.0.0 (2017-09-20)
Breaking changes:
- BREAKING: Switch to Puppet Data Types (ldap_cfg is now undef when disabled) #66 (wyardley)
- BREAKING: Create grafana_plugin resource type and change grafana::plugins #63 (wyardley)
- BREAKING: Update default Grafana version to 4.5.1 and improve acceptance tests #61 (wyardley)
Implemented enhancements:
- grafana_user custom resource #60 (atward)
- Support newer versions of puppetlabs/apt module #53 (ghoneycutt)
- Support custom plugins #44 (bastelfreak)
Fixed bugs:
- gpg key error on CentOS 7 with default params #59
- wget called even if not necessary #54
- Fix typo in provider #58 (atward)
Closed issues:
- install_method 'docker" ignores all other configurations #51
- Usable for Grafana 4.x? #37
- Remove docker dependency #22
Merged pull requests:
- Update README.md #67 (wyardley)
- Get rid of the dependency on 'wget' module in favor of puppet-archive #65 (wyardley)
- Remove licenses from the top of files #64 (wyardley)
- Release 4.0.0 #62 (bastelfreak)
- Always use jessie apt repo when osfamily is Debian. #41 (furhouse)
v3.0.0 (2017-03-29)
Implemented enhancements:
- implement package_ensure param for archlinux #34 (bastelfreak)
Fixed bugs:
Closed issues:
- Configured grafana debian repo should contain current distribution #27
- Error while creating dashboard #25
Merged pull requests:
- Bump version, Update changelog #38 (dhoppe)
- Debian and RedHat based operating systems should use the repository by default #36 (dhoppe)
- Add support for archlinux #32 (bastelfreak)
- Fix grafana_dashboards #31 (c10l)
- supoort jessie for install method repo #28 (roock)
- Use operatinsystemmajrelease fact in repo url #24 (mirekys)
- The puppet 4-only release will start at 3.0.0 #21 (rnelson0)
v2.6.3 (2017-01-18)
v2.6.2 (2017-01-18)
v2.6.1 (2017-01-18)
Just a notice: The next release will be a major one without Puppet 3 support! This is the last Release that supports it!
Releasing v2.6.0 (2017-01-18)
Enhancements
- add two types & provider:
grafana_datasource
&grafana_dashboard
these type allow configuration of the datasource and the dashboard against the API - allow configuration of
repo_name
for all installation methods - be more conservative when installing from docker, while also allowing users to
override our
stable
choice
Fixes
- ensure correct ownership of downloaded artefact
- fix use-before definition of
$version
: https://github.com/bfraser/puppet-grafana/issues/87
Behind The Scenes
- switch to voxpupuli/archive from camptocamp
Changes since forking from bfraser/puppet-grafana
- Add CONTRIBUTING.MD as well as our issues, spec etc… templates
- update README and other files to point to forked repository
- Rubocop and ruby-lint style-fixes!
- test with puppet > 4.x
2.5.0 (2015-10-31)
Enhancements
- Support for Grafana 2.5. This is just a version bump to reflect that Grafana 2.5 is now installed by default
- PR #58 Sort
cfg
keys soconfig.ini
content is not updated every Puppet run
Fixes
- Issue #52 Version logic moved to
init.pp
so overriding the version of Grafana to install works as intended
Behind The Scenes
- PR #59 More specific version requirements in
metadata.json
due to use ofcontain
function - PR #61 Fixed typos in
metadata.json
2.1.0 (2015-08-07)
Enhancements
- Support for Grafana 2.1
- Issue #40 Support for LDAP integration
- PR #34 Support for 'repo' install method to install packages from packagecloud repositories
- Addition of boolean parameter
manage_package_repo
to control whether the module will manage the package repository when using the 'repo' install method. See README.md for details - PR #39 Ability to ensure a specific package version is installed when using the 'repo' install method
Fixes
- Issue #37 Archive install method: check if user and service are already defined before attempting to define them
- Issue #42 Package versioning for RPM / yum systems
- Issue #45 Fix resource dependency issues when
manage_package_repo
is false
Behind The Scenes
- Use 40 character GPG key ID for packagecloud apt repository
2.0.2 (2015-04-30)
Enhancements
- Support for Grafana 2.0. Users of Grafana 1.x should stick to version 1.x of the Puppet module
- Support 'archive', 'docker' and 'package' install methods
- Ability to supply a hash of parameters to the Docker container when using 'docker' install method
- PR #24 Ability to configure Grafana using configuration hash parameter
cfg
Behind The Scenes
- Update module operatingsystem support, tags, Puppet requirements
- Tests for 'archive' and 'package' install methods
1.0.1 (2015-02-27)
Enhancements
- New parameter for Grafana admin password
Fixes
- Package install method now makes use of install_dir for config.js path
Behind The Scenes
- Add archive module to .fixtures.yml
- Unquote booleans to make lint happy
- Fix license identifier and unbounded dependencies in module metadata
- Allow Travis to fail on Ruby 1.8.7
- More Puppet versions are tested by Travis
1.0.0 (2014-12-16)
Enhancements
- Add max_search_results parameter
- Install Grafana 1.9.0 by default
Documentation
- Add download_url and install_method parameters to README
Behind The Scenes
- Issue #6 Replace gini/archive dependency with camptocamp/archive
- Addition of CHANGELOG
- Style fixes
- Removal of vagrant-wrapper gem
- Fancy badges for build status
0.2.2 (2014-10-27)
Enhancements
- Add default_route parameter to manage start dashboard
Fixes
- Symlink behavior
Behind The Scenes
- Issue #9 Remove stdlib inclusion from manifest
0.2.1 (2014-10-14)
Enhancements
- Support for multiple datasources
- Install Grafana 1.8.1 by default
Behind The Scenes
- Added RSpec tests
- Add stdlib as a module dependency
- Add operating system compatibility
0.1.3 (2014-07-03)
Enhancements
- Added support for InfluxDB
0.1.2 (2014-06-30)
First release on the Puppet Forge
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs/stdlib (>= 4.20.0 < 10.0.0)
- puppet/archive (>= 1.0.1 < 8.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.