Install grafana and link it to HA
This commit is contained in:
parent
301ac37868
commit
9d014cfa1c
5 changed files with 63 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
- intersect-docker
|
- intersect-docker
|
||||||
- plausible
|
- plausible
|
||||||
- duplicati
|
- duplicati
|
||||||
|
- grafana
|
||||||
|
|
||||||
# Arch boxes
|
# Arch boxes
|
||||||
- hosts:
|
- hosts:
|
||||||
|
|
19
ansible/roles/grafana/files/docker-compose.yml
Normal file
19
ansible/roles/grafana/files/docker-compose.yml
Normal 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
|
4
ansible/roles/grafana/handlers/main.yml
Normal file
4
ansible/roles/grafana/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- name: restart grafana
|
||||||
|
shell:
|
||||||
|
chdir: /opt/grafana
|
||||||
|
cmd: "{{ docker_update_command }}"
|
30
ansible/roles/grafana/tasks/main.yml
Normal file
30
ansible/roles/grafana/tasks/main.yml
Normal 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
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue