feat: initial commit
This commit is contained in:
parent
846bc41aa1
commit
4f744469c0
17 changed files with 324 additions and 0 deletions
66
tasks/prometheus.yaml
Normal file
66
tasks/prometheus.yaml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
|
||||
# create directories
|
||||
- name: "create prometheus directory"
|
||||
ansible.builtin.file:
|
||||
path: "/mnt/prometheus"
|
||||
state: "directory"
|
||||
mode: "0775"
|
||||
|
||||
- name: "create prometheus data directory"
|
||||
ansible.builtin.file:
|
||||
path: "/mnt/prometheus/data"
|
||||
state: "directory"
|
||||
mode: "0775"
|
||||
|
||||
# create prometheus config
|
||||
- name: "create prometheus config"
|
||||
ansible.builtin.copy:
|
||||
dest: "/mnt/prometheus/prometheus.yml"
|
||||
mode: "0644"
|
||||
content: |
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
scrape_configs:
|
||||
- job_name: 'unbound'
|
||||
static_configs:
|
||||
- targets: ['dns01.siempie.internal:9167']
|
||||
- targets: ['dns02.siempie.internal:9167']
|
||||
notify: "restart prometheus"
|
||||
|
||||
# run prometheus
|
||||
- name: "run prometheus"
|
||||
community.docker.docker_container:
|
||||
|
||||
# docker defaults
|
||||
auto_remove: "no"
|
||||
container_default_behavior: "no_defaults"
|
||||
detach: "yes"
|
||||
init: "no"
|
||||
interactive: "no"
|
||||
log_driver: "json-file"
|
||||
log_options:
|
||||
max-size: "5m"
|
||||
max-file: "3"
|
||||
memory: "0"
|
||||
paused: "no"
|
||||
privileged: "no"
|
||||
pull: "always"
|
||||
read_only: "no"
|
||||
state: "started"
|
||||
tty: "no"
|
||||
|
||||
# run prometheus
|
||||
name: "prometheus"
|
||||
image: "docker.io/prom/prometheus:3.7.2"
|
||||
image_name_mismatch: "recreate"
|
||||
restart_policy: "unless-stopped"
|
||||
network_mode: "host"
|
||||
|
||||
volumes:
|
||||
- "/mnt/prometheus/data:/prometheus"
|
||||
- "/mnt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
|
||||
|
||||
command:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
Loading…
Add table
Add a link
Reference in a new issue