51 lines
1.2 KiB
YAML
51 lines
1.2 KiB
YAML
---
|
|
- name: Install necessary packages
|
|
apt:
|
|
name: apt-transport-https
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: add apt-key
|
|
apt_key:
|
|
url: https://packages.grafana.com/gpg.key
|
|
state: present
|
|
|
|
- name: grafana-repository hinzufuegen
|
|
become: yes
|
|
apt_repository:
|
|
repo: 'deb https://packages.grafana.com/oss/deb stable main'
|
|
state: present
|
|
filename: grafana_repo
|
|
update_cache: yes
|
|
|
|
- name: Install grafana
|
|
apt:
|
|
name: grafana
|
|
state: present
|
|
update_cache: yes
|
|
notify:
|
|
- restart_grafana_service
|
|
- enable_grafana_service
|
|
|
|
- name: templating grafana.ini
|
|
template:
|
|
src: grafana.ini
|
|
dest: /etc/grafana/grafana.ini
|
|
notify:
|
|
- restart_grafana_service
|
|
|
|
- name: start_grafana_service
|
|
service:
|
|
name: grafana-server
|
|
state: started
|
|
|
|
- name: Create influxdb datasource
|
|
grafana_datasource:
|
|
name: "{{ grafana_telegraf_database_name }}"
|
|
grafana_url: "{{ grafana_url }}"
|
|
grafana_user: "{{ grafana_user }}"
|
|
grafana_password: "{{ grafana_password }}"
|
|
ds_type: "influxdb"
|
|
ds_url: "{{ grafana_influx_url }}"
|
|
database: "{{ grafana_telegraf_database_name }}"
|
|
state: present
|