aboutsummaryrefslogtreecommitdiff
path: root/roles/monitoring/tasks/prometheus.yaml
blob: 0fbfd89c58da5d6a737968a521d15862369e877d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
---

# Install Prometheus as TSDB for monitoring metrics
- name: 'Copy the prometheus.yml config file to conf dir'
  template:
    src: 'prometheus.yml.j2'
    dest: '{{ monitoring_root_dir }}/prometheus.yml'
    mode: '0644'

- name: 'Make sure prometheus container is created and running'
  docker_container:
    name: 'prometheus'
    image: 'prom/prometheus:v2.37.0'
    pull: true
    state: 'started'
    recreate: true
    command: '--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus'
    user: 'root'
    volumes:
      - "{{ monitoring_root_dir }}/prometheus.yml:/etc/prometheus/prometheus.yml"
      - "{{ monitoring_root_dir }}/prom_data:/data/prometheus"
    network_mode: 'host'
    restart_policy: unless-stopped