This is an ansible role for installing Grafana on Debian and RedHat distributions.It uses the infrastructure testing tool KitchenCi to verify if the infrastructure is well setup and configured as expected.
-
Python 2.7 or higher
-
Ansible 2.3.1.0(pip install ansible==2.3.1.0)
-
Vagrant 1.9
-
Virtualbox 5.1.
- Debian
- Ubuntu
- Centos
More infos in the role's metadata file.
None.
Available variables are listed below, along with the default values.
grafana_port: 3000
- grafana server portgrafana_user: grafana
- grafana usergrafana_group: grafana
- grafana groupgrafana_home: /usr/share/grafana
- grafana home directorygrafana_log_directory: /var/log/grafana
- grafana log directorygrafana_data_directory: /var/lib/grafana
- grafana data directorygrafana_conf_directory: /etc/grafana
- grafana configuration directorygrafana_conf_file: /etc/grafana/grafana.ini
- grafana configuration filegrafana_directory_plugin: /var/lib/grafana/plugins
- grafana plugins directory
You can add other option/value pairs if you need to set other options for the Grafana init file.
- grafana_init_changes:
- option: "GRAFANA_USER"
value: "{{ grafana_user }}"
- option: "GRAFANA_GROUP"
value: "{{ grafana_group }}"
- option: "GRAFANA_HOME"
value: "{{ grafana_home }}"
- option: "LOG_DIR"
value: "{{ grafana_log_directory }}"
- option: "DATA_DIR"
value: "{{ grafana_data_directory }}"
- option: "CONF_DIR"
value: "{{ grafana_conf_directory }}"
- option: "CONF_FILE"
value: "{{ grafana_conf_file }}"
- option: "PLUGINS_DIR"
value: "{{ grafana_directory_plugin }}"
This role install the stable version of grafana by default, you can override these variables to install other version.
- # For Debian (role default):
grafana_repo_url: deb https://packagecloud.io/grafana/stable/debian/ jessie main
grafana_repo_key_url: https://packagecloud.io/gpg.key
# For RedHat/CentOS(role default):
grafana_repo_url: https://packagecloud.io/grafana/stable/el/6/$basearch
grafana_repo_key_url: https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
those are the variables related to the grafana repository setup, you can override these variables by adding your specific values.
- # For Debian (role default):
grafana_repo_filename: grafana
# For RedHat/CentOS(role default):
grafana_repo_name: grafana
grafana_repo_description: YUM repository
install-grafana
- Default tag to perform grafana installation
In order to set up a grafana server across your plateform, start by checking out the role from Ansible galaxy:
ansible-galaxy install sbouii.grafana
Finally call the role within you Ansible playbook:
---
- hosts: localhost
sudo: yes
roles:
- sbouii.grafana
For quick tests, you can spin up a Debian VM using Vagrant. You maybe need to adapt the Vagrantfile to suit your environment (IP addresses, etc).
$ vagrant up
For runing Acceptance/Integration tests against your role , we use the tool test-kitchen
.All written acceptance tests are in the ./test/integration/ directory.
The .kitchen.yml
file describes the testing configuration and the list of suite tests to run. By default, the instances will be converged with Ansible and ran in Vagrant virtual machines.
To list the instances:
$ kitchen list
Instance Driver Provisioner Verifier Transport Last Action
default-debian-8-x64 Vagrant AnsiblePlaybook Busser Ssh <Not Created>
...
To run the default test suite, for instance, on a Ubuntu Trusty platform, run the following command:
$ kitchen test default-ubuntu-1404-x64
This role was created by Mariem Sbouii .