Bootstrap grafana role
This commit is contained in:
commit
477446c348
7 changed files with 135 additions and 0 deletions
13
LICENCE
Normal file
13
LICENCE
Normal file
|
@ -0,0 +1,13 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2019 Wilfried OLLIVIER <wollivier@fdn.fr>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
51
README.md
Normal file
51
README.md
Normal file
|
@ -0,0 +1,51 @@
|
|||
galaxy-grafana.ds.influx
|
||||
========================
|
||||
|
||||
Add an InfluxDB datasource to Grafana
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
An InfluxDB service up and running
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
- grafana_proto: https or http, used by grafana
|
||||
- grafana_domain: domain name used by grafana
|
||||
- grafana_port: port used by grafana
|
||||
- grafana_url_port: port used by grafana in url
|
||||
|
||||
- grafana_admin_user: grafana admin user
|
||||
- grafana_admin_pass: grafana admin passwd
|
||||
|
||||
- datasource_name: name of the datasource to link grafana with influx
|
||||
- influx_url: url of inluxdb
|
||||
- influx_proto: proto http or https used by influx
|
||||
- influx_port: port used influx
|
||||
- influx_db_name: influxdb name to link to grafana
|
||||
- influx_user: influxdb username
|
||||
- influx_pass: influxdb passe to link to grafana
|
||||
- grafana_org_id: org ig (number)
|
||||
- is_default: yes/no is this the default source
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
None
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- role: galaxy-grafana.ds.influx
|
||||
|
||||
Run tests
|
||||
---------
|
||||
|
||||
Ensure galaxy-vagrant is up
|
||||
|
||||
ansible-playbook -i tests/inventory tests/test.yml
|
23
defaults/main.yml
Normal file
23
defaults/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
|
||||
# Protocol and networking stuff
|
||||
grafana_proto: http
|
||||
grafana_domain: galaxy-vagrant.example.com
|
||||
grafana_port: 3000
|
||||
grafana_url_port: 3000
|
||||
|
||||
# Admmin user stuff
|
||||
grafana_admin_user: admin
|
||||
grafana_admin_pass: not24get
|
||||
|
||||
# InfluxDB datasource
|
||||
influx_datasource_setup: true
|
||||
datasource_name: influxdb-telegraf
|
||||
influx_url: localhost
|
||||
influx_proto: http
|
||||
influx_port: 8086
|
||||
influx_db_name: telegraf
|
||||
influx_user: telegraf
|
||||
influx_pass: not24get
|
||||
grafana_org_id: 1
|
||||
is_default: yes
|
23
meta/main.yml
Normal file
23
meta/main.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
galaxy_info:
|
||||
author: Wilfried OLLIVIER
|
||||
description: Galaxy role to add an InfluxDB data source to Grafana
|
||||
company: none
|
||||
|
||||
license: WTFPL
|
||||
|
||||
min_ansible_version: 2.4
|
||||
|
||||
platforms:
|
||||
- name: Debian
|
||||
versions:
|
||||
- Stretch
|
||||
- Buster
|
||||
|
||||
galaxy_tags:
|
||||
- grafana
|
||||
- datasource
|
||||
- influx
|
||||
- debian
|
||||
- timeseries
|
||||
|
||||
dependencies: []
|
19
tasks/main.yml
Normal file
19
tasks/main.yml
Normal file
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
|
||||
# https://grafana.com/docs/installation/debian/
|
||||
|
||||
- name: Create InfluxDB datasource
|
||||
grafana_datasource:
|
||||
name: "{{ datasource_name }}"
|
||||
grafana_url: "{{ grafana_proto }}://{{ grafana_domain }}:{{ grafana_port }}"
|
||||
grafana_user: "{{ grafana_admin_user }}"
|
||||
grafana_password: "{{ grafana_admin_pass }}"
|
||||
org_id: "{{ grafana_org_id }}"
|
||||
ds_type: "influxdb"
|
||||
url: "{{ influx_proto }}://{{ influx_url }}:{{ influx_port }}"
|
||||
database: "{{ influx_db_name }}"
|
||||
basic_auth_user: "{{ influx_user }}"
|
||||
basic_auth_password: "{{ influx_pass }}"
|
||||
is_default: "{{ is_default }}"
|
||||
time_interval: ">10s"
|
||||
when: influx_datasource_setup
|
1
tests/inventory
Normal file
1
tests/inventory
Normal file
|
@ -0,0 +1 @@
|
|||
galaxy-vagrant.example.com
|
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- hosts: galaxy-vagrant.example.com
|
||||
remote_user: root
|
||||
roles:
|
||||
- role: ../galaxy-grafana.ds.influx
|
Reference in a new issue