From 733967175f49429645088026794d1188e840de29 Mon Sep 17 00:00:00 2001 From: Wilfried OLLIVIER Date: Wed, 10 Jul 2019 17:12:12 +0200 Subject: [PATCH] Bootstrap grafana.plugin role --- LICENCE | 13 +++++++++++++ README.md | 33 +++++++++++++++++++++++++++++++++ defaults/main.yml | 4 ++++ handlers/main.yml | 6 ++++++ meta/main.yml | 21 +++++++++++++++++++++ tasks/main.yml | 9 +++++++++ tests/inventory | 1 + tests/test.yml | 5 +++++ 8 files changed, 92 insertions(+) create mode 100644 LICENCE create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..5568253 --- /dev/null +++ b/LICENCE @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2019 Wilfried OLLIVIER + + 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..11f729a --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +galaxy-grafana.ds.influx +======================== + +Add an InfluxDB datasource to Grafana + +Requirements +------------ + +An InfluxDB service up and running + +Role Variables +-------------- + +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 + +Run tests +--------- + +Ensure galaxy-vagrant is up + + ansible-playbook -i tests/inventory tests/test.yml \ No newline at end of file diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..2d03cc6 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,4 @@ +--- + +plugin_name: raintank-worldping-app +plugin_version: latest \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..ba0e20d --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,6 @@ +--- + +- name: restart grafana + systemd: + name: grafana-server + state: restarted \ No newline at end of file diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..25ec690 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,21 @@ +galaxy_info: + author: Wilfried OLLIVIER + description: Galaxy role to add plugin to a Grafana instance + company: none + + license: WTFPL + + min_ansible_version: 2.4 + + platforms: + - name: Debian + versions: + - Stretch + - Buster + + galaxy_tags: + - grafana + - plugins + - debian + +dependencies: [] \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..a0d6d95 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,9 @@ +--- + +# Needs restart to be found in plugins menu +- name: Add Grafana plugin + grafana_plugin: + name: "{{ plugin_name }}" + version: "{{ plugin_version }}" + state: present + notify: restart grafana \ No newline at end of file diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..38d0757 --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +galaxy-vagrant.example.com diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..693ff2c --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: galaxy-vagrant.example.com + remote_user: root + roles: + - role: ../galaxy-grafana.plugin \ No newline at end of file