xoxys.grafana/tasks/setup.yml
Robert Kaussow 2a956db2c9
All checks were successful
continuous-integration/drone/push Build is passing
fix typo in variable
2021-09-04 23:46:13 +02:00

66 lines
1.7 KiB
YAML

---
- block:
- name: Add Grafana repository
yum_repository:
name: grafana
file: Grafana
description: Grafana Repository
baseurl: https://packages.grafana.com/oss/rpm
gpgkey: https://packages.grafana.com/gpg.key
gpgcheck: yes
- name: Ensure dependencies are installed
package:
name: "{{ item }}"
state: present
loop: "{{ grafana_packages_extra }}"
- name: Ensure Grafana is installed
package:
name: "{{ item }}"
state: present
loop:
- grafana
- name: Ensure Grafana directories exist
file:
path: "{{ item }}"
state: directory
owner: grafana
group: grafana
mode: 0750
loop:
- "{{ grafana_data_dir }}"
- "{{ grafana_log_dir }}"
- "{{ grafana_plugin_dir }}"
- name: Write config file
template:
src: etc/grafana/grafana.ini.j2
dest: /etc/grafana/grafana.ini
owner: root
group: grafana
mode: 0640
notify: __grafana_restart
- name: Copy custom grafana datasource files
template:
src: "{{ item }}"
dest: /etc/grafana/provisioning/datasources/{{ item | basename | splitext | first }}
owner: root
group: grafana
mode: 0640
with_fileglob: "{{ grafana_datasource_files }}"
loop_control:
label: "{{ item | basename | splitext | first }}"
notify: __grafana_restart
- name: Ensure Grafana is up and running
service:
name: grafana-server
daemon_reload: yes
enabled: yes
state: started
become: True
become_user: root