mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-25 05:10:20 +00:00
refactor: support customizing alertmanager url/mirror
Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
parent
5e3e8e6b95
commit
9f4c0243e5
4 changed files with 7 additions and 4 deletions
|
@ -20,6 +20,8 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
|
|||
| -------------- | ------------- | -----------------------------------|
|
||||
| `alertmanager_version` | 0.21.0 | Alertmanager package version. Also accepts `latest` as parameter. |
|
||||
| `alertmanager_binary_local_dir` | "" | Allows to use local packages instead of ones distributed on github. As parameter it takes a directory where `alertmanager` AND `amtool` binaries are stored on host on which ansible is ran. This overrides `alertmanager_version` parameter |
|
||||
| `alertmanager_binary_url` | `https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz` | URL of the alertmanager binaries .tar.gz file |
|
||||
| `alertmanager_checksums_url` | `https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/sha256sums.txt` | URL of the alertmanager checksums file |
|
||||
| `alertmanager_web_listen_address` | 0.0.0.0:9093 | Address on which alertmanager will be listening |
|
||||
| `alertmanager_web_external_url` | http://localhost:9093/ | External address on which alertmanager is available. Useful when behind reverse proxy. Ex. example.org/alertmanager |
|
||||
| `alertmanager_config_dir` | /etc/alertmanager | Path to directory with alertmanager configuration |
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
---
|
||||
alertmanager_version: 0.21.0
|
||||
alertmanager_binary_local_dir: ''
|
||||
alertmanager_binary_url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/\
|
||||
alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
alertmanager_checksums_url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/sha256sums.txt"
|
||||
|
||||
alertmanager_config_dir: /etc/alertmanager
|
||||
alertmanager_db_dir: /var/lib/alertmanager
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
- name: Download alertmanager binary to local folder
|
||||
become: false
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/prometheus/alertmanager/releases/download/v{{ alertmanager_version }}/\
|
||||
alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
url: "{{ alertmanager_binary_url }}"
|
||||
dest: "/tmp/alertmanager-{{ alertmanager_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
checksum: "sha256:{{ __alertmanager_checksum }}"
|
||||
mode: 0644
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
block:
|
||||
- name: "Get checksum list"
|
||||
ansible.builtin.set_fact:
|
||||
__alertmanager_checksums: "{{ lookup('url', 'https://github.com/prometheus/alertmanager/releases/download/v' + alertmanager_version +
|
||||
'/sha256sums.txt', wantlist=True) | list }}"
|
||||
__alertmanager_checksums: "{{ lookup('url', alertmanager_checksums_url, wantlist=True) | list }}"
|
||||
run_once: true
|
||||
until: __alertmanager_checksums is search('linux-' + go_arch + '.tar.gz')
|
||||
retries: 10
|
||||
|
|
Loading…
Reference in a new issue