Skip to content

Commit

Permalink
feat: add default for retention size
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger committed Feb 22, 2022
1 parent 86f88f7 commit a4b1eed
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Building and improving this Ansible role have been sponsored by my employer **Pr
* [prometheus_rule_files](#prometheus_rule_files)
* [prometheus_scrape_configs](#prometheus_scrape_configs)
* [prometheus_scrape_interval](#prometheus_scrape_interval)
* [prometheus_tsdb_retention_size](#prometheus_tsdb_retention_size)
* [prometheus_tsdb_retention_time](#prometheus_tsdb_retention_time)
* [prometheus_version](#prometheus_version)
* [Dependencies](#dependencies)
Expand Down Expand Up @@ -366,6 +367,16 @@ Global default scrape interval
prometheus_scrape_interval: 15s
```

### prometheus_tsdb_retention_size

Retention size to define the maximum size of the data

#### Default value

```YAML
prometheus_tsdb_retention_size:
```

### prometheus_tsdb_retention_time

Retention time to define the maximum age of the data
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ prometheus_evaluation_interval: 15s
# @var prometheus_tsdb_retention_time:description: Retention time to define the maximum age of the data
prometheus_tsdb_retention_time: 30d

# @var prometheus_tsdb_retention_size:description: Retention size to define the maximum size of the data
prometheus_tsdb_retention_size:

# @var prometheus_rule_files:description: List of paths to read rule files from
prometheus_rule_files:
- /etc/prometheus/rules/*.yml
Expand Down
9 changes: 9 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
path: "{{ item }}"
owner: prometheus
group: prometheus
mode: u=rwx,g=rx,o=rx
state: directory
tags:
- prometheus
Expand All @@ -40,6 +41,7 @@
path: "{{ item }}"
owner: prometheus
group: prometheus
mode: u=rwx,g=rx,o=rx
state: directory
tags:
- prometheus
Expand Down Expand Up @@ -154,6 +156,7 @@
dest: /etc/prometheus/config.yml
owner: prometheus
group: prometheus
mode: u=rw,g=r,o=r
tags:
- prometheus

Expand Down Expand Up @@ -224,6 +227,9 @@
template:
src: default.j2
dest: /etc/default/prometheus
owner: root
group: root
mode: u=rw,g=r,o=r
tags:
- prometheus

Expand All @@ -233,6 +239,9 @@
template:
src: service.j2
dest: /etc/systemd/system/prometheus.service
owner: root
group: root
mode: u=rw,g=r,o=r
tags:
- prometheus

Expand Down
6 changes: 6 additions & 0 deletions tasks/oauth2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
template:
src: oauth2/default.j2
dest: /etc/default/prometheus-oauth2
owner: root
group: root
mode: u=rw,g=r,o=r
tags:
- prometheus
- oauth2
Expand All @@ -92,6 +95,9 @@
template:
src: oauth2/service.j2
dest: /etc/systemd/system/prometheus-oauth2.service
owner: root
group: root
mode: u=rw,g=r,o=r
tags:
- prometheus
- oauth2
Expand Down
2 changes: 1 addition & 1 deletion templates/default.j2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ARGS="--config.file=/etc/prometheus/config.yml --web.external-url={{ prometheus_domain }} --web.enable-lifecycle --web.enable-admin-api --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time={{ prometheus_tsdb_retention_time }} --web.listen-address={{ prometheus_listen_address }}"
ARGS="--config.file=/etc/prometheus/config.yml --web.external-url={{ prometheus_domain }} --web.enable-lifecycle --web.enable-admin-api --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries --storage.tsdb.path=/var/lib/prometheus{{ ' --storage.tsdb.retention.time=' + prometheus_tsdb_retention_time if prometheus_tsdb_retention_time | default(False) else '' }}{{ ' --storage.tsdb.retention.size=' + prometheus_tsdb_retention_size if prometheus_tsdb_retention_size | default(False) else '' }} --web.listen-address={{ prometheus_listen_address }}"

0 comments on commit a4b1eed

Please sign in to comment.