Skip to content

Commit

Permalink
feat: add storage volume for prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
temarusanov committed Nov 8, 2023
1 parent ec16149 commit 33145e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions devops/ansible/roles/prometheus/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ prometheus__ports:
- 9090:9090
prometheus__restart_policy: always
prometheus__template: prometheus.yml.j2
prometheus__storage_dir_source: /etc/prometheus/storage
7 changes: 7 additions & 0 deletions devops/ansible/roles/prometheus/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
state: directory
mode: "0755"

- name: Create a directory if it does not exist {{ prometheus__storage_dir_source }}
ansible.builtin.file:
path: "{{ prometheus__storage_dir_source }}"
state: directory
mode: "7777"

- name: Template config to /etc/prometheus/prometheus.yml
ansible.builtin.template:
src: "{{ prometheus__template }}"
Expand All @@ -24,6 +30,7 @@
restart_policy: "{{ prometheus__restart_policy }}"
volumes:
- /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:rw
- "{{ prometheus__storage_dir_source }}:/prometheus"
network_mode: "{{ prometheus__network_mode }}"
networks: "{{ prometheus__networks }}"
expose: "{{ prometheus__ports }}"
Expand Down

0 comments on commit 33145e9

Please sign in to comment.