add prometheus service

This commit is contained in:
Pim Kunis 2023-07-23 11:28:43 +02:00
parent b40c6ca579
commit dad67c8731
5 changed files with 66 additions and 12 deletions

View file

@ -35,6 +35,8 @@ nfs_shares:
path: /mnt/data/overleaf/redis path: /mnt/data/overleaf/redis
- name: overleaf_mongodb - name: overleaf_mongodb
path: /mnt/data/overleaf/mongodb path: /mnt/data/overleaf/mongodb
- name: prometheus_data
path: /mnt/data/prometheus/data
database_passwords: database_passwords:
nextcloud: !vault | nextcloud: !vault |

View file

@ -19,3 +19,4 @@
- {role: pihole, tags: pihole} - {role: pihole, tags: pihole}
- {role: nextcloud, tags: nextcloud} - {role: nextcloud, tags: nextcloud}
- {role: syncthing, tags: syncthing} - {role: syncthing, tags: syncthing}
- {role: prometheus, tags: prometheus}

View file

@ -1,3 +1,5 @@
---
roles:
- name: setup_apt - name: setup_apt
src: https://github.com/sunscrapers/ansible-role-apt.git src: https://github.com/sunscrapers/ansible-role-apt.git
scm: git scm: git

View file

@ -0,0 +1,36 @@
# vi: ft=yaml
version: "3"
networks:
traefik:
external: true
volumes:
data:
driver_opts:
type: "nfs"
o: "addr=192.168.30.10,nolock,soft,rw"
device: ":/mnt/data/prometheus/data"
services:
prometheus:
image: quay.io/prometheus/prometheus
networks:
- traefik
# volumes:
# - type: volume
# source: data
# target: /prometheus
# volume:
# nocopy: true
deploy:
labels:
- traefik.enable=true
- traefik.http.routers.prometheus.entrypoints=localsecure
- traefik.http.routers.prometheus.rule=Host(`metrics.kun.is`)
- traefik.http.routers.prometheus.tls=true
- traefik.http.routers.prometheus.tls.certresolver=letsencrypt
- traefik.http.routers.prometheus.service=prometheus
- traefik.http.services.prometheus.loadbalancer.server.port=9090
- traefik.docker.network=traefik

View file

@ -0,0 +1,13 @@
#- name: Create prometheus config
# docker_config:
# name: prometheus_config
# data: "{{ lookup('file', '{{ role_path }}/prometheus.yml') }}"
# use_ssh_client: true
# rolling_versions: true
# register: config
- name: Deploy Docker stack
docker_stack:
name: prometheus
compose:
- "{{ lookup('template', '{{ role_path }}/docker-stack.yml.j2') | from_yaml }}"