prometheus: allow setting custom retention time
15 days is default and also too short.
This commit is contained in:
parent
5ba04824f1
commit
be7eca3a89
3 changed files with 15 additions and 1 deletions
|
|
@ -1,3 +1,3 @@
|
|||
Install and configure prometheus.
|
||||
|
||||
Job definitions should be placed in /etc/prometheus/conf.d by roles using this one.
|
||||
Job definitions should be placed in /etc/prometheus/conf.d by roles using this one. Data retention time can be set with the `retention` property in a NetBox config context.
|
||||
|
|
|
|||
|
|
@ -3,3 +3,9 @@
|
|||
name: prometheus
|
||||
state: reloaded
|
||||
when: "'handler' not in ansible_skip_tags"
|
||||
|
||||
- name: restart prometheus
|
||||
service:
|
||||
name: prometheus
|
||||
state: restarted
|
||||
when: "'handler' not in ansible_skip_tags"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@
|
|||
path: /etc/prometheus/conf.d
|
||||
state: directory
|
||||
|
||||
- name: Configure prometheus retention time
|
||||
when: retention is defined
|
||||
lineinfile:
|
||||
path: /etc/conf.d/prometheus
|
||||
regexp: "^prometheus_retention_time="
|
||||
line: "prometheus_retention_time={{ retention }}"
|
||||
notify: restart prometheus
|
||||
|
||||
- name: Configure prometheus
|
||||
copy:
|
||||
dest: /etc/prometheus/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue