summaryrefslogtreecommitdiff
path: root/roles/monitoring/grafana
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2022-03-22 19:08:58 +0100
committerChristian Pointner <equinox@spreadspace.org>2022-03-22 19:08:58 +0100
commitdfcaa508312666505e64141bd697ea8ad6c69498 (patch)
treef39baa26ef46dcee5fe8dc1487c1975f337fc5b8 /roles/monitoring/grafana
parentmonitoring/prometheus: pinning packages (diff)
monitoring/grafana: pinning packages
Diffstat (limited to 'roles/monitoring/grafana')
-rw-r--r--roles/monitoring/grafana/defaults/main.yml2
-rw-r--r--roles/monitoring/grafana/tasks/main.yml18
2 files changed, 19 insertions, 1 deletions
diff --git a/roles/monitoring/grafana/defaults/main.yml b/roles/monitoring/grafana/defaults/main.yml
index 0f68fb43..10eac947 100644
--- a/roles/monitoring/grafana/defaults/main.yml
+++ b/roles/monitoring/grafana/defaults/main.yml
@@ -1,4 +1,6 @@
---
+# grafana_version:
+
# grafana_secret_key: <--- pwgen -s 64 -1
grafana_root_url: "%(protocol)s://%(domain)s:%(http_port)s/grafana"
diff --git a/roles/monitoring/grafana/tasks/main.yml b/roles/monitoring/grafana/tasks/main.yml
index 8194d717..ffba1108 100644
--- a/roles/monitoring/grafana/tasks/main.yml
+++ b/roles/monitoring/grafana/tasks/main.yml
@@ -3,10 +3,26 @@
include_role:
name: apt-repo/grafana
+- name: generate apt pin file for grafana package
+ when: grafana_version is defined
+ copy:
+ dest: "/etc/apt/preferences.d/grafana.pref"
+ content: |
+ Package: grafana
+ Pin: version {{ grafana_version }}
+ Pin-Priority: 1001
+
+- name: remove apt pin file for grafana package
+ when: grafana_version is not defined
+ file:
+ path: "/etc/apt/preferences.d/grafana.pref"
+ state: absent
+
- name: install apt packages
apt:
- name: grafana
+ name: "grafana{% if grafana_version is defined %}={{ grafana_version }}{% endif %}"
state: present
+ allow_downgrade: yes
- name: configure grafana server
loop: "{{ grafana_config_server | dict2items }}"