Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #94 from cloudalchemy/issue90
Browse files Browse the repository at this point in the history
[minor] allow `latest` as prometheus_version
  • Loading branch information
paulfantom authored Apr 13, 2018
2 parents a5ff80e + fb8d551 commit 9398d4f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults

| Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------|
| `prometheus_version` | 2.2.1 | Prometheus package version |
| `prometheus_version` | 2.2.1 | Prometheus package version. Also accepts `latest` as parameter. |
| `prometheus_config_dir` | /etc/prometheus | Path to directory with prometheus configuration |
| `prometheus_db_dir` | /var/lib/prometheus | Path to directory with prometheus database |
| `prometheus_web_listen_address` | "0.0.0.0:9090" | Address on which prometheus will be listening |
Expand Down
18 changes: 18 additions & 0 deletions tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,21 @@
when: not prometheus_config_dir + "/file_sd/" + item.key + ".yml" in file_sd_files
# when: not item | basename | splitext | difference(['.yml']) | join('') in prometheus_targets.keys()
with_dict: "{{ prometheus_targets }}"

- block:
- name: get latest release
uri:
url: "https://api.github.com/repos/prometheus/prometheus/releases/latest"
method: GET
return_content: yes
status_code: 200
body_format: json
validate_certs: no
register: _latest_release
until: result.status == 200
retries: 5

- name: "Set prometheus version to {{ _latest_release.json.tag_name[1:] }}"
set_fact:
prometheus_version: "{{ _latest_release.json.tag_name[1:] }}"
when: prometheus_version == "latest"

0 comments on commit 9398d4f

Please sign in to comment.