galaxy-grafana/tasks/main.yml

41 lines
794 B
YAML

---
# https://grafana.com/docs/installation/debian/
- name: Install some required pkg
apt:
name: [ 'software-properties-common', 'apt-transport-https' ]
state: present
update_cache: yes
- name: Add Grafana apt key
apt_key:
url: https://packages.grafana.com/gpg.key
state: present
- name: Add Grafana repo to apt
apt_repository:
repo: "{{ grafana.repo }}"
state: present
filename: grafana
- name: Install grafana
apt:
name: grafana
state: present
update_cache: yes
- name: Push Grafana config
template:
src: grafana.ini.j2
dest: /etc/grafana/grafana.ini
notify: reload grafana
register: conf
- name: Enable and restart Grafana
systemd:
name: grafana-server
state: restarted
enabled: yes
when: conf.changed