add prometheus service
This commit is contained in:
parent
b40c6ca579
commit
dad67c8731
5 changed files with 66 additions and 12 deletions
|
@ -35,6 +35,8 @@ nfs_shares:
|
|||
path: /mnt/data/overleaf/redis
|
||||
- name: overleaf_mongodb
|
||||
path: /mnt/data/overleaf/mongodb
|
||||
- name: prometheus_data
|
||||
path: /mnt/data/prometheus/data
|
||||
|
||||
database_passwords:
|
||||
nextcloud: !vault |
|
||||
|
|
|
@ -19,3 +19,4 @@
|
|||
- {role: pihole, tags: pihole}
|
||||
- {role: nextcloud, tags: nextcloud}
|
||||
- {role: syncthing, tags: syncthing}
|
||||
- {role: prometheus, tags: prometheus}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
---
|
||||
roles:
|
||||
- name: setup_apt
|
||||
src: https://github.com/sunscrapers/ansible-role-apt.git
|
||||
scm: git
|
||||
|
|
36
ansible/roles/prometheus/docker-stack.yml.j2
Normal file
36
ansible/roles/prometheus/docker-stack.yml.j2
Normal 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
|
13
ansible/roles/prometheus/tasks/main.yml
Normal file
13
ansible/roles/prometheus/tasks/main.yml
Normal 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 }}"
|
Reference in a new issue