grafana
: Installs and configures Grafana.grafana::validator
: Manage grafana_conn_validator resource
grafana::config
: Manage grafana configurationgrafana::install
: Manage grafana installationgrafana::service
: Manage grafana service
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
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
change_grafana_admin_password
: Change the Grafana admin user's password
Installs and configures Grafana.
class { '::grafana':
install_method => 'docker',
}
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_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
Data type: Optional[String]
Download location of tarball to be used with the 'archive' install method.
Default value: undef
Data type: String
Location of the configuration file.
Data type: Optional[Variant[Hash,Array[Hash],Sensitive[Hash],Sensitive[Array[Hash]]]]
Default value: undef
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
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 type: String
The directory Grafana will use for storing its data.
Default value: '/var/lib/grafana'
Data type: String
Installation directory to be used with the 'archive' install method.
Default value: '/usr/share/grafana'
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.
Data type: Boolean
If true this will setup the official grafana repositories on your host.
Data type: String
The name of the package managed with the 'package' install method.
Data type: Optional[String]
Download location of package to be used with the 'package' install method.
Default value: undef
Data type: String
The name of the service managed with the 'archive' and 'package' install methods.
Data type: String
The version of Grafana to install and manage.
Default value: 'installed'
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'
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'
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'
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
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.
Data type: Hash
Plugins to be passed to create_resources
, wraps around the
grafana_plugin
resource.
Default value: {}
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: {}
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: {}
Data type: String
Fully qualified path to place the provisioning file for dashboards, only used if provisioning_dashboards is specified.
Default value: '/etc/grafana/provisioning/dashboards/puppetprovisioned.yaml'
Data type: String
Fully qualified path to place the provisioning file for datasources, only used if provisioning_datasources is specified.
Default value: '/etc/grafana/provisioning/datasources/puppetprovisioned.yaml'
Data type: Boolean
If true puppet will create any subdirectories in the given path when provisioning dashboards.
Default value: false
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'.
Data type: Optional[Hash]
Environment variables for the grafana-server service
Example: sysconfig => { 'http_proxy' => 'http://proxy.example.com/' }
Default value: undef
Data type: Hash[String[1], Hash]
Servers to be passed to create_resources
, wraps around the
grafana_ldap_server
resource.
Default value: {}
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: {}
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
Data type: String[1]
Name of the software-package providing the TOML parser library.
Default value: 'ruby-toml'
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'
Data type: Optional[String[1]]
The package-provider used to install the TOML parser library.
Default value: undef
Data type: String
name of the docker image that provides grafana
Default value: 'grafana/grafana'
Data type: String
ports docker should expose
Default value: '3000:3000'
Data type: String
explicit Iteration / epoch for the rpm
Default value: '1'
Data type: Variant[Hash,Sensitive[Hash]]
The whole grafana configuration
Default value: {}
Manage grafana_conn_validator resource
The following parameters are available in the grafana::validator
class:
Data type: Stdlib::HTTPUrl
Grafana URL.
Default value: 'http://localhost:3000'
Data type: Stdlib::Absolutepath
API path to validate with.
Default value: '/api/health'
Verify connectivity to the Grafana API
The following properties are available in the grafana_conn_validator
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The following parameters are available in the grafana_conn_validator
type.
The absolute path to the API endpoint
Default value: /api/health
The URL of the Grafana server
Default value: http://localhost:3000
namevar
Arbitrary name of this resource
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.
How long to wait for the API to be available
Default value: 20
Manage dashboards in Grafana
The following properties are available in the grafana_dashboard
type.
The JSON representation of the dashboard.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The following parameters are available in the grafana_dashboard
type.
The folder to place the dashboard in (optional)
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server (optional)
The URL of the Grafana server
Default value: ''
The username for the Grafana server (optional)
The organization name to create the datasource on
Default value: 1
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.
The title of the dashboard.
Manage dashboard permissions in Grafana
The following properties are available in the grafana_dashboard_permission
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Valid values: Admin
, Edit
, View
The role to apply
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 to modify permissions for
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The name of the permission.
The name of the organization to add permission for
Default value: Main Org.
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 to add the permission for
User to add the permission for
Manage datasources in Grafana
The following properties are available in the grafana_datasource
type.
Valid values: direct
, proxy
Whether the datasource is accessed directly or not by the clients
Valid values: true
, false
Whether basic auth is enabled or not
The password for basic auth if enabled
The username for basic auth if enabled
The name of the database (optional)
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Valid values: true
, false
Whether the datasource is the default one
Additional JSON data to configure the datasource (optional)
The password for the datasource (optional)
Additional secure JSON data to configure the datasource (optional)
The datasource type
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
The URL/Endpoint of the datasource
The username for the datasource (optional)
Valid values: true
, false
Whether credentials such as cookies or auth headers should be sent with cross-site requests
The following parameters are available in the grafana_datasource
type.
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The name of the datasource.
The organization name to create the datasource on
Default value: 1
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.
Manage folders in Grafana
The following properties are available in the grafana_folder
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The permissions of the folder
The following parameters are available in the grafana_folder
type.
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server (optional)
The URL of the Grafana server
Default value: ''
The username for the Grafana server (optional)
The organization name to create the folder on
Default value: 1
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.
The title of the folder
UID of the folder
Manage Grafana LDAP configuration
The following parameters are available in the grafana_ldap_config
type.
Valid values: true
, false
, yes
, no
Backup existing files before replacing them into the file-bucket
Default value: false
Group of the LDAP configuration file either as String or Integer (default: grafana)
Default value: grafana
File-permissions mode of the LDAP configuration file as String
Default value: 0440
Owner of the LDAP configuration-file either as String or Integer (default: root)
Default value: root
Valid values: true
, false
, yes
, no
Replace existing files
Default value: true
Path to ldap.toml
A command to validate the new Grafana LDAP configuration before actually replacing it
Map an LDAP group to a Grafana role.
The following parameters are available in the grafana_ldap_group_mapping
type.
Valid values: true
, false
, yes
, no
Additonal flag for Grafana > v5.3 to signal admin-role to Grafana
Default value: false
The LDAP distinguished-name of the group
The LDAP server config to apply the group-mappings on
Valid values: Admin
, Editor
, Viewer
The Grafana role the shall be assigned to this group
A unique identifier of the resource
Manage Grafana LDAP servers for LDAP authentication.
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
Mapping LDAP attributes to their Grafana user-account-properties (optional)
If the LDAP server requires authentication (i.e. non-anonymous), provide the distinguished-name (dn) here (optional)
If the LDAP server requires authentication (i.e. non-anonymous), provide the password (optional)
If the LDAP server requires certificate-based authentication, specify the client's certificate (for TLS and SSL, optional)
If the LDAP server requires certificate-based authentication, specify the client's certificate (for TLS and SSL, optional)
The base-dn to be used when querying LDAP for group-accounts (optional)
A search-filter to be used when querying LDAP for group-accounts (optional)
The attribute to be used to locate matching user-accounts in the group (optional)
The servers to perform LDAP authentication at
The port to connect at the LDAP servers (389 for TLS/plaintext, 636 for SSL [ldaps], optional)
Default value: 389
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
The one or more base-dn to be used when querying LDAP for user-accounts (optional)
Default value: []
A search-filter to be used when querying LDAP for user-accounts (optional)
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
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
A unique identified for this LDAP server.
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
Manage resource memberships in Grafana
The following properties are available in the grafana_membership
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
Valid values: Admin
, Editor
, Viewer
The role to apply to the membership (Admin, Editor, Viewer)
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
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
Valid values: organization
, team
The underlying type of the membership (organization, team)
namevar
The name of the membership.
The name of the organization to add membership for (team only)
Default value: Main Org.
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.
The name of the target to add membership for
The name of the user to add membership for
Manage notification in Grafana
The following properties are available in the grafana_notification
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The notification reminder frequency
Valid values: true
, false
Whether the notification is the default one
Default value: false
Valid values: true
, false
Whether automatic message resending is enabled or not
Default value: false
Additional JSON data to configure the notification
The notification type
The following parameters are available in the grafana_notification
type.
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The name of the notification.
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.
Manage organizations in Grafana
The following properties are available in the grafana_organization
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The following parameters are available in the grafana_organization
type.
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The name of the organization.
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.
manages grafana plugins
grafana_plugin { 'grafana-simple-json-datasource': }
grafana_plugin { 'grafana-simple-json-datasource':
ensure => 'present',
repo => 'https://nexus.company.com/grafana/plugins',
}
grafana_plugin { 'grafana-example-custom-plugin':
ensure => 'present',
plugin_url => 'https://github.com/example/example-custom-plugin/zipball/v1.0.0'
}
grafana_plugin { 'grafana-simple-json-datasource':
ensure => 'absent',
}
$ puppet resource grafana_plugin
The following properties are available in the grafana_plugin
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The following parameters are available in the grafana_plugin
type.
Valid values: %r{^\S+$}
namevar
The name of the plugin to enable
Full url to the plugin zip file
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.
The URL of an internal plugin server
Manage teams in Grafana
The following properties are available in the grafana_team
type.
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The id or name of the home dashboard
Default value: Default
The UID or name of the home dashboard folder
The theme to use for the team
The timezone to use for the team
The following parameters are available in the grafana_team
type.
The email for the team
Default value: ''
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The name of the team
The organization the team belongs to
Default value: Main Org.
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.
Manage users in Grafana
The following properties are available in the grafana_user
type.
The email for the user
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
The full name of the user.
Valid values: true
, false
Whether the user is a grafana admin
A hash of organizations and roles
The password for the user
The theme for the user
The following parameters are available in the grafana_user
type.
The absolute path to the API endpoint
Default value: /api
The password for the Grafana server
The URL of the Grafana server
Default value: ''
The username for the Grafana server
namevar
The username of the user.
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.
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.
== 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
Data type: String
Data type: Hash
Data type: Optional[String]
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' ]
== 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
Data type: String
Change the Grafana admin user's password
Supports noop? false
Data type: Optional[String[1]]
The old admin password
Data type: Optional[String[1]]
The new admin password
Data type: Enum['http','https']
http or https
Data type: Integer
The port Grafana is running on