From f87cce28d1ca0219c958a3c3bf032c18a852efa9 Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Fri, 2 Jun 2017 15:28:52 +0200 Subject: [PATCH 1/2] new type: __grafana_dashboard --- cdist/conf/type/__grafana_dashboard/man.rst | 43 +++++++++++++++++++ cdist/conf/type/__grafana_dashboard/manifest | 23 ++++++++++ cdist/conf/type/__grafana_dashboard/singleton | 0 3 files changed, 66 insertions(+) create mode 100644 cdist/conf/type/__grafana_dashboard/man.rst create mode 100644 cdist/conf/type/__grafana_dashboard/manifest create mode 100644 cdist/conf/type/__grafana_dashboard/singleton diff --git a/cdist/conf/type/__grafana_dashboard/man.rst b/cdist/conf/type/__grafana_dashboard/man.rst new file mode 100644 index 00000000..b3974028 --- /dev/null +++ b/cdist/conf/type/__grafana_dashboard/man.rst @@ -0,0 +1,43 @@ +cdist-type__grafana_dashboard(7) +================================ + +NAME +---- +cdist-type__grafana_dashboard - Install Grafana (https://grafana.com) + + +DESCRIPTION +----------- +This cdist type adds the Grafana repository, installs the grafana package, and sets the server to start on boot. + +This is a singleton type. + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +.. code-block:: sh + + __grafana_dashboard + + +AUTHORS +------- +Kamila Součková + + +COPYING +------- +Copyright \(C) 2017 Kamila Součková. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. diff --git a/cdist/conf/type/__grafana_dashboard/manifest b/cdist/conf/type/__grafana_dashboard/manifest new file mode 100644 index 00000000..c5bc78d2 --- /dev/null +++ b/cdist/conf/type/__grafana_dashboard/manifest @@ -0,0 +1,23 @@ +os=$(cat $__global/explorer/os) + +case $os in + debian|devuan) + __apt_key_uri grafana \ + --name 'Grafana Release Signing Key' \ + --uri https://packagecloud.io/gpg.key + + require="__apt_key_uri/grafana" __apt_source grafana \ + --uri https://packagecloud.io/grafana/stable/debian/ \ + --distribution jessie \ + --component main + + __package apt-transport-https + + require="__apt_source/grafana __package/apt-transport-https" __package grafana + require="__package/grafana" __start_on_boot grafana-server + ;; + *) + echo "Don't know how to install Grafana on $os. Send us a pull request!" + exit 1 + ;; +esac diff --git a/cdist/conf/type/__grafana_dashboard/singleton b/cdist/conf/type/__grafana_dashboard/singleton new file mode 100644 index 00000000..e69de29b From 4c7327e81462d11d7ba53bf6c38a990f12549c84 Mon Sep 17 00:00:00 2001 From: Kamila Souckova Date: Fri, 9 Jun 2017 18:40:47 +0200 Subject: [PATCH 2/2] consider de(bi|vu)an version --- cdist/conf/type/__grafana_dashboard/manifest | 29 +++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/cdist/conf/type/__grafana_dashboard/manifest b/cdist/conf/type/__grafana_dashboard/manifest index c5bc78d2..b6e3020e 100644 --- a/cdist/conf/type/__grafana_dashboard/manifest +++ b/cdist/conf/type/__grafana_dashboard/manifest @@ -1,20 +1,29 @@ os=$(cat $__global/explorer/os) +os_version=$(cat $__global/explorer/os_version) case $os in debian|devuan) - __apt_key_uri grafana \ - --name 'Grafana Release Signing Key' \ - --uri https://packagecloud.io/gpg.key + case $os_version in + 8*|jessie) + __apt_key_uri grafana \ + --name 'Grafana Release Signing Key' \ + --uri https://packagecloud.io/gpg.key - require="__apt_key_uri/grafana" __apt_source grafana \ - --uri https://packagecloud.io/grafana/stable/debian/ \ - --distribution jessie \ - --component main + require="__apt_key_uri/grafana" __apt_source grafana \ + --uri https://packagecloud.io/grafana/stable/debian/ \ + --distribution jessie \ + --component main - __package apt-transport-https + __package apt-transport-https - require="__apt_source/grafana __package/apt-transport-https" __package grafana - require="__package/grafana" __start_on_boot grafana-server + require="__apt_source/grafana __package/apt-transport-https" __package grafana + require="__package/grafana" __start_on_boot grafana-server + ;; + *) + echo "Don't know how to install Grafana on $os $os_version. Send us a pull request!" + exit 1 + ;; + esac ;; *) echo "Don't know how to install Grafana on $os. Send us a pull request!"