33 lines
849 B
YAML
33 lines
849 B
YAML
---
|
|
- name: Create prometheus docker volume
|
|
become: true
|
|
community.docker.docker_volume:
|
|
name: prometheus
|
|
- name: Create prometheus config dir
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /etc/prometheus
|
|
state: directory
|
|
mode: "1755"
|
|
owner: root
|
|
group: root
|
|
- name: Copy prometheus config
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: prometheus.yml.j2
|
|
dest: /etc/prometheus/prometheus.yml
|
|
mode: "0644"
|
|
owner: root
|
|
group: root
|
|
register: prometheus_cfg
|
|
- name: Create prometheus container
|
|
become: true
|
|
community.docker.docker_container:
|
|
name: prometheus
|
|
image: prom/prometheus:v2.54.1
|
|
networks:
|
|
- name: monitoring
|
|
volumes:
|
|
- prometheus:/prometheus
|
|
- /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
recreate: "{{ prometheus_cfg.changed }}"
|