Restore dockerized grafana setup
It's stil on a separate machine, but in docker to allow more applications to be run easier and tied together.
This commit is contained in:
parent
b940d22373
commit
149d01165f
4 changed files with 55 additions and 75 deletions
33
ansible/roles/forrest/files/docker-compose.yml
Normal file
33
ansible/roles/forrest/files/docker-compose.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
version: "2.3"
|
||||
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
environment:
|
||||
- TZ=Europe/London
|
||||
- GF_DATABASE_URL=postgres://grafana:grafana@db/grafana
|
||||
- GF_RENDERING_SERVER_URL=http://renderer:8081/render
|
||||
- GF_RENDERING_CALLBACK_URL=http://grafana:3000/
|
||||
volumes:
|
||||
- ./grafana:/var/lib/grafana
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3000:3000
|
||||
depends_on:
|
||||
- db
|
||||
- renderer
|
||||
|
||||
db:
|
||||
image: postgres:12-alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./postgres:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=grafana
|
||||
- POSTGRES_USER=grafana
|
||||
|
||||
renderer:
|
||||
image: grafana/grafana-image-renderer:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- BROWSER_TZ=Europe/London
|
|
@ -1,11 +1,4 @@
|
|||
- name: restart grafana
|
||||
service:
|
||||
name: grafana-server
|
||||
state: restarted
|
||||
become: true
|
||||
|
||||
- name: restart influxdb
|
||||
service:
|
||||
name: influxdb
|
||||
state: restarted
|
||||
become: true
|
||||
shell:
|
||||
chdir: /opt/grafana
|
||||
cmd: "{{ docker_update_command }}"
|
||||
|
|
17
ansible/roles/forrest/tasks/grafana.yml
Normal file
17
ansible/roles/forrest/tasks/grafana.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
- name: Create install directory
|
||||
file:
|
||||
path: /opt/grafana
|
||||
state: directory
|
||||
owner: "{{ docker_user.name }}"
|
||||
mode: "{{ docker_compose_directory_mask }}"
|
||||
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: docker-compose -f %s config
|
||||
notify: restart grafana
|
||||
become: true
|
|
@ -1,65 +1,2 @@
|
|||
- name: Add grafana repository
|
||||
apt_repository:
|
||||
repo: deb https://packages.grafana.com/oss/deb stable main
|
||||
state: present
|
||||
filename: grafana
|
||||
|
||||
- name: Add influxdb repository
|
||||
apt_repository:
|
||||
repo: deb https://repos.influxdata.com/debian buster stable
|
||||
state: present
|
||||
filename: influxdb
|
||||
|
||||
- name: Install grafana
|
||||
package:
|
||||
name: grafana
|
||||
become: true
|
||||
|
||||
- name: Install influxdb
|
||||
package:
|
||||
name: grafana
|
||||
become: true
|
||||
loop:
|
||||
- influxdb
|
||||
- chronograf
|
||||
|
||||
- name: Enable grafana
|
||||
service:
|
||||
name: grafana-server
|
||||
enabled: true
|
||||
become: true
|
||||
|
||||
- name: Enable influxdb
|
||||
service:
|
||||
name: influxdb
|
||||
enabled: true
|
||||
become: true
|
||||
|
||||
- name: Configure influxdb
|
||||
ini_file:
|
||||
path: /etc/influxdb/influxdb.conf
|
||||
mode: "0644"
|
||||
section: "{{ item.section }}"
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
become: true
|
||||
notify: restart influxdb
|
||||
loop_control:
|
||||
label: "{{ item.section }}.{{ item.option }}={{ item.value }}"
|
||||
loop:
|
||||
- {section: http, option: bind-address, value: 0.0.0.0:8086}
|
||||
- {section: http, option: auth-enabled, value: "true"}
|
||||
|
||||
- name: Configure grafana
|
||||
ini_file:
|
||||
path: /etc/grafana/grafana.ini
|
||||
mode: "0644"
|
||||
section: "{{ item.section }}"
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
become: true
|
||||
notify: restart grafana
|
||||
loop_control:
|
||||
label: "{{ item.section }}.{{ item.option }}={{ item.value }}"
|
||||
loop:
|
||||
- {section: server, option: domain, value: grafana.jakehoward.tech}
|
||||
- name: Grafana
|
||||
include: grafana.yml
|
||||
|
|
Loading…
Reference in a new issue