aboutsummaryrefslogtreecommitdiff
path: root/roles/grafana/tasks/main.yml
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-04-04 21:24:22 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-04-04 21:24:22 +0200
commite835ea003eb91a534bfcead68062562e6ed1e665 (patch)
tree590f4d91c0514377895433f7d68d8b9eef7cf287 /roles/grafana/tasks/main.yml
parent03984cc21f9b2fbc6925a0c29d078fd140240a91 (diff)
downloadansible_collection-e835ea003eb91a534bfcead68062562e6ed1e665.tar.gz
add grafana
Diffstat (limited to 'roles/grafana/tasks/main.yml')
-rw-r--r--roles/grafana/tasks/main.yml48
1 files changed, 48 insertions, 0 deletions
diff --git a/roles/grafana/tasks/main.yml b/roles/grafana/tasks/main.yml
new file mode 100644
index 0000000..745f0af
--- /dev/null
+++ b/roles/grafana/tasks/main.yml
@@ -0,0 +1,48 @@
+---
+- name: Install GnuPG
+ apt:
+ name: gnupg2
+ become: yes
+
+- name: Install Grafana STABLE Repository
+ copy:
+ dest: /etc/apt/sources.list.d/grafana.list
+ content: deb https://packages.grafana.com/oss/deb stable main
+ become: yes
+ register: install_repo
+
+- name: Install Grafana Repo Key
+ apt_key:
+ url: https://packages.grafana.com/gpg.key
+ state: present
+ become: yes
+
+- name: Update APT cache
+ apt:
+ update_cache: yes
+ become: yes
+ when: install_repo.changed
+
+- name: Install Grafana
+ apt:
+ name: grafana
+ become: yes
+ notify: Restart Grafana
+
+- name: Check for changed cert
+ command: /bin/true
+ when: cert_changed
+ notify: Restart Grafana
+
+- name: Install configuration
+ template:
+ src: '{{ item }}.j2'
+ dest: '/etc/grafana/{{ item }}'
+ owner: root
+ group: grafana
+ mode: '640'
+ become: yes
+ loop:
+ - grafana.ini
+ - ldap.toml
+ notify: Restart Grafana