Ansible Role grafana
This role installs and configures Grafana.
Mandatory Requirements
Enable the official Grafana OSS Repository. This can be done using the linuxfabrik.lfops.repo_grafana role.
Mandatory Role Variables
Variable |
Description |
---|---|
|
The Grafana admin account. |
|
The root url on which Grafana is reachable. |
Example:
# mandatory
grafana__admin_login:
username: 'grafana-admin-user'
password: 'linuxfabrik'
grafana__root_url: 'https://monitoring.example.com/grafana'
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
Whether to allow browsers to render Grafana in a |
|
|
The url on which the Grafana API is reachable. This might differ from the |
|
|
Whether to allow anonymous (passwordless) access or not. Possible options: |
|
|
The organization name that should be used for unauthenticated users. |
|
|
The role for unauthenticated users. |
|
|
Will be used to store the token of the created service accounts to this Bitwarden Collection. Can be obtained from the URL in Bitwarden WebGUI. |
`‘{{ lfops__bitwarden_collection_id |
|
Will be used to store the token of the created service accounts to this Bitwarden Organization. Can be obtained from the URL in Bitwarden WebGUI. |
`‘{{ lfops__bitwarden_organization_id |
|
The SameSite cookie attribute. Possible options: |
|
|
Determines whether HTTPS is enabled or not. Subkeys:
|
unset |
|
The configuration to use a LDAP user base for logging into Grafana. More information can be found here. Subkeys:
|
unset |
|
List of dictionaries containing Grafana plugins. Subkeys:
For the usage in host_vars / group_vars (can only be used in one group at a time). |
|
|
List of dictionaries containing the dashboards to deploy via provisioning. Subkeys:
For the usage in host_vars / group_vars (can only be used in one group at a time). |
|
|
List of dictionaries containing the datasources to deploy via provisioning. Subkeys:
For the usage in host_vars / group_vars (can only be used in one group at a time). |
|
|
List of dictionaries containing service accounts to create. It automatically creates a token for the service account, with the same role as the service account itself. Beware that the token is only displayed once during the Ansible run, or optionally saved to Bitwarden. Subkeys:
For the usage in host_vars / group_vars (can only be used in one group at a time). |
|
|
Bool. Whether Grafana itself should run on a subpath or not. Only effective if there is a subpath in |
|
|
Bool. Enables or disables the service, analogous to |
|
|
Skip the storing of the service account tokens to Bitwarden. |
|
|
Email server settings. More information can be found here: https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#smtp. Subkeys: |
unset |
|
Have a look at https://grafana.com/blog/2022/12/12/guide-to-using-the-new-grafana-cli-user-identity-conflict-tool-in-grafana-9.3 |
unset |
|
If set to |
|
Example:
# optional
grafana__allow_embedding: true
grafana__api_url: 'https://grafana01.example.com/grafana'
grafana__auth_anonymous_enabled: false
grafana__auth_anonymous_org_name: 'Main Org.'
grafana__auth_anonymous_org_role: 'Viewer'
grafana__cookie_samesite: 'lax'
grafana__https_config:
cert_file: '/etc/ssl/ssl-certificate.crt'
cert_key: '/etc/ssl/ssl-certificate.key'
grafana__ldap_config:
username: 'uid'
bind_dn: 'uid=freeipa-reader,cn=sysaccounts,cn=etc,dc=example,dc=com'
bind_password: 'linuxfabrik'
editor_group_dn: 'cn=monitoring,cn=groups,cn=accounts,dc=example,dc=com'
host: 'ldap.example.com'
port: 389
search_base_dns:
- 'cn=users,cn=accounts,dc=example,dc=com'
search_filter: '(uid=%s)' # or for example: '(cn=%s)' or '(sAMAccountName=%s)'
viewer_group_dn: '*'
grafana__plugins__group_var: []
grafana__plugins__host_var:
- name: 'yesoreyeram-infinity-datasource'
grafana__provisioning_dashboards__group_var: []
grafana__provisioning_dashboards__host_var:
- name: 'linuxfabrik-monitoring-plugins'
orgId: 1
folder: 'Linuxfabrik Monitoring Plugins'
folderUid: 'linuxfabrik-monitoring-plugins'
type: 'file'
disableDeletion: false
editable: false
updateIntervalSeconds: 60
options:
path: '/var/lib/grafana/dashboards/linuxfabrik-monitoring-plugins'
grafana__provisioning_datasources__group_var: []
grafana__provisioning_datasources__host_var:
- name: 'InfluxDB'
type: 'influxdb'
access: 'proxy'
orgId: 1
url: 'http://{{ icinga2_master__influxdb_host }}:8086'
user: '{{ icinga2_master__influxdb_login["username"] }}'
database: '{{ icinga2_master__influxdb_database_name }}'
isDefault: true
jsonData:
timeInterval: '1m'
tlsAuth: false
tlsAuthWithCACert: false
secureJsonData:
password: '{{ icinga2_master__influxdb_login["password"] }}'
version: 1
editable: false
- name: 'icinga_director'
type: 'mysql'
access: 'proxy'
orgId: 1
url: '{{ icingaweb2_module_director__database_host }}:3306'
user: '{{ icingaweb2_module_director__database_login["username"] }}'
database: '{{ icingaweb2_module_director__database_name }}'
isDefault: false
secureJsonData:
password: '{{ icingaweb2_module_director__database_login["password"] }}'
version: 1
editable: false
grafana__provisioning_service_accounts__group_var: []
grafana__provisioning_service_accounts__host_var:
- name: 'grizzly'
role: 'Admin'
grafana__serve_from_sub_path: false
grafana__service_enabled: true
grafana__skip_token_to_bitwarden: true
grafana__smtp_config:
host: 'mail.example.com:25'
user: 'smtp-user'
password: 'linuxfabrik'
from_address: 'grafana@example.com'
grafana__users_case_insensitive_login: false
grafana__validate_certs: true