mirror of
https://github.com/prometheus-community/ansible
synced 2025-02-16 12:48:26 +00:00
refactor: support customizing snmp_exporter url/mirror
Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
parent
12a8260b2b
commit
7f81fc0216
4 changed files with 7 additions and 3 deletions
|
@ -17,6 +17,8 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
|
|||
| Name | Default Value | Description |
|
||||
| -------------- | ------------- | -----------------------------------|
|
||||
| `snmp_exporter_version` | 0.19.0 | SNMP exporter package version |
|
||||
| `snmp_exporter_binary_url` | `https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz` | URL of the snmp exporter binaries .tar.gz file |
|
||||
| `snmp_exporter_checksums_url` | `https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt` | URL of the snmp exporter checksums file |
|
||||
| `snmp_exporter_web_listen_address` | "0.0.0.0:9116" | Address on which SNMP exporter will be listening |
|
||||
| `snmp_exporter_config_file` | "" | If this is empty, role will download snmp.yml file from https://github.com/prometheus/snmp_exporter. Otherwise this should contain path to file with custom snmp exporter configuration |
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
snmp_exporter_version: 0.19.0
|
||||
snmp_exporter_binary_url: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/\
|
||||
snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
||||
snmp_exporter_checksums_url: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/sha256sums.txt"
|
||||
snmp_exporter_web_listen_address: "0.0.0.0:9116"
|
||||
snmp_exporter_log_level: info
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
- name: Download snmp_exporter binary to local folder
|
||||
become: false
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/prometheus/snmp_exporter/releases/download/v{{ snmp_exporter_version }}/\
|
||||
snmp_exporter-{{ snmp_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
|
||||
url: "{{ snmp_exporter_binary_url }}"
|
||||
dest: "/tmp"
|
||||
checksum: "sha256:{{ snmp_exporter_checksum }}"
|
||||
mode: 0644
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
ansible.builtin.set_fact:
|
||||
snmp_exporter_checksum: "{{ item.split(' ')[0] }}"
|
||||
with_items:
|
||||
- "{{ lookup('url', 'https://github.com/prometheus/snmp_exporter/releases/download/v' + snmp_exporter_version + '/sha256sums.txt', wantlist=True) | list }}"
|
||||
- "{{ lookup('url', snmp_exporter_checksums_url, wantlist=True) | list }}"
|
||||
when: "('linux-' + (go_arch_map[ansible_architecture] | default(ansible_architecture)) + '.tar.gz') in item"
|
||||
|
|
Loading…
Add table
Reference in a new issue