mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-25 13:20:22 +00:00
refactor: support customizing prometheus url/mirror
Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
parent
9f4c0243e5
commit
e57ae9b9d7
4 changed files with 7 additions and 4 deletions
|
@ -26,6 +26,8 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
|
|||
| `prometheus_skip_install` | false | Prometheus installation tasks gets skipped when set to true. |
|
||||
| `prometheus_binary_local_dir` | "" | Allows to use local packages instead of ones distributed on github. As parameter it takes a directory where `prometheus` AND `promtool` binaries are stored on host on which ansible is ran. This overrides `prometheus_version` parameter |
|
||||
| `prometheus_config_dir` | /etc/prometheus | Path to directory with prometheus configuration |
|
||||
| `prometheus_binary_url` | `https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz` | URL of the prometheus binaries .tar.gz file |
|
||||
| `prometheus_checksums_url` | `https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/sha256sums.txt` | URL of the prometheus checksums file |
|
||||
| `prometheus_db_dir` | /var/lib/prometheus | Path to directory with prometheus database |
|
||||
| `prometheus_read_only_dirs`| [] | Additional paths that Prometheus is allowed to read (useful for SSL certs outside of the config directory) |
|
||||
| `prometheus_web_listen_address` | "0.0.0.0:9090" | Address on which prometheus will be listening |
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
prometheus_version: 2.27.0
|
||||
prometheus_binary_local_dir: ''
|
||||
prometheus_binary_url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/\
|
||||
prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
prometheus_checksums_url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/sha256sums.txt"
|
||||
prometheus_skip_install: false
|
||||
|
||||
prometheus_config_dir: /etc/prometheus
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
- name: Download prometheus binary to local folder
|
||||
become: false
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version }}/\
|
||||
prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
url: "{{ prometheus_binary_url }}"
|
||||
dest: "/tmp/prometheus-{{ prometheus_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
checksum: "sha256:{{ __prometheus_checksum }}"
|
||||
mode: 0644
|
||||
|
|
|
@ -91,8 +91,7 @@
|
|||
block:
|
||||
- name: "Get checksum list"
|
||||
ansible.builtin.set_fact:
|
||||
__prometheus_checksums: "{{ lookup('url', 'https://github.com/prometheus/prometheus/releases/download/v' + prometheus_version + '/sha256sums.txt',
|
||||
wantlist=True) | list }}"
|
||||
__prometheus_checksums: "{{ lookup('url', prometheus_checksums_url, wantlist=True) | list }}"
|
||||
run_once: true
|
||||
until: __prometheus_checksums is search('linux-' + go_arch + '.tar.gz')
|
||||
retries: 10
|
||||
|
|
Loading…
Reference in a new issue