ansible/roles/prometheus/tasks/main.yml

68 lines
2.0 KiB
YAML

# vim:ft=ansible:
- name: deploy prometheus
block:
- name: ensure prometheus dirs
ansible.builtin.file:
state: directory
owner: 5476
group: 5476
mode: "0750"
path: "{{ item }}"
with_items:
- /data/prometheus/config
- /data/prometheus/data
notify: restart prometheus container
- name: template out configuration file
ansible.builtin.template:
src: prometheus.yml.j2
owner: 5476
group: 5476
mode: "0640"
dest: /data/prometheus/config/prometheus.yml
notify: restart prometheus container
- name: docker deploy prometheus
community.docker.docker_container:
name: prometheus
image: prom/prometheus:latest
restart_policy: unless-stopped
user: 5476:5476
env:
TZ: "America/Chicago"
networks:
- name: web
aliases: [ "prometheus" ]
volumes:
- /data/prometheus/config:/etc/prometheus
- /data/prometheus/data:/prometheus
- name: deploy prometheus blackbox
block:
- name: ensure blackbox dirs
ansible.builtin.file:
state: directory
owner: 5476
group: 5476
mode: "0750"
path: /data/prometheus/blackbox
notify: restart blackbox container
- name: template out configuration file
ansible.builtin.template:
src: blackbox.yml.j2
owner: 5476
group: 5476
mode: "0640"
dest: /data/prometheus/blackbox/blackbox.yml
notify: restart blackbox container
- name: docker deploy prometheus blackbox
community.docker.docker_container:
name: prometheus-blackbox
image: quay.io/prometheus/blackbox-exporter:latest
restart_policy: unless-stopped
user: 5476:5476
command:
- '--config.file=/config/blackbox.yml'
networks:
- name: web
aliases: [ "blackbox" ]
volumes:
- /data/prometheus/blackbox:/config