Install grafana and link it to HA

This commit is contained in:
Jake Howard 2020-08-07 11:52:15 +01:00
parent 301ac37868
commit 9d014cfa1c
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 63 additions and 0 deletions

View file

@ -33,6 +33,7 @@
- intersect-docker - intersect-docker
- plausible - plausible
- duplicati - duplicati
- grafana
# Arch boxes # Arch boxes
- hosts: - hosts:

View file

@ -0,0 +1,19 @@
version: "2.3"
services:
grafana:
image: grafana/grafana:latest
environment:
- TZ=Europe/London
ports:
- 3000:3000
volumes:
- ./grafana:/var/lib/grafana
restart: unless-stopped
networks:
- default
- grafana
networks:
grafana:
external: true

View file

@ -0,0 +1,4 @@
- name: restart grafana
shell:
chdir: /opt/grafana
cmd: "{{ docker_update_command }}"

View file

@ -0,0 +1,30 @@
- name: Create install directory
file:
path: /opt/grafana
state: directory
owner: "{{ docker_user.name }}"
mode: "{{ docker_compose_directory_mask }}"
become: true
- name: Create grafana network
docker_network:
name: grafana
- name: Create config directory
file:
path: /opt/grafana/grafana
state: directory
mode: "{{ docker_compose_directory_mask }}"
owner: "472"
group: "472"
become: true
- name: Install compose file
template:
src: files/docker-compose.yml
dest: /opt/grafana/docker-compose.yml
mode: "{{ docker_compose_file_mask }}"
owner: "{{ docker_user.name }}"
validate: /usr/bin/docker-compose -f %s config
notify: restart grafana
become: true

View file

@ -24,6 +24,11 @@ services:
- ./influxdb:/var/lib/influxdb - ./influxdb:/var/lib/influxdb
ports: ports:
- 127.0.0.1:48086:8086 - 127.0.0.1:48086:8086
networks:
default:
grafana:
aliases:
- ha-influxdb
environment: environment:
- INFLUXDB_DB=home_assistant - INFLUXDB_DB=home_assistant
- INFLUXDB_HTTP_AUTH_ENABLED= - INFLUXDB_HTTP_AUTH_ENABLED=
@ -34,3 +39,7 @@ services:
network_mode: host network_mode: host
volumes: volumes:
- ./esphome:/config - ./esphome:/config
networks:
grafana:
external: true