mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-10 06:14:13 +00:00
refactor: support customizing node_exporter url/mirror
Signed-off-by: gardar <gardar@users.noreply.github.com>
This commit is contained in:
parent
e57ae9b9d7
commit
12a8260b2b
4 changed files with 8 additions and 4 deletions
|
@ -24,6 +24,8 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
|
|||
| -------------- | ------------- | -----------------------------------|
|
||||
| `node_exporter_version` | 1.1.2 | Node exporter package version. Also accepts latest as parameter. |
|
||||
| `node_exporter_binary_local_dir` | "" | Enables the use of local packages instead of those distributed on github. The parameter may be set to a directory where the `node_exporter` binary is stored on the host where ansible is run. This overrides the `node_exporter_version` parameter |
|
||||
| `node_exporter_binary_url` | `https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz` | URL of the node exporter binaries .tar.gz file |
|
||||
| `node_exporter_checksums_url` | `https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/sha256sums.txt` | URL of the node exporter checksums file |
|
||||
| `node_exporter_web_listen_address` | "0.0.0.0:9100" | Address on which node exporter will listen |
|
||||
| `node_exporter_web_telemetry_path` | "/metrics" | Path under which to expose metrics |
|
||||
| `node_exporter_enabled_collectors` | ```["systemd",{textfile: {directory: "{{node_exporter_textfile_dir}}"}}]``` | List of dicts defining additionally enabled collectors and their configuration. It adds collectors to [those enabled by default](https://github.com/prometheus/node_exporter#enabled-by-default). |
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
node_exporter_version: 1.1.2
|
||||
node_exporter_binary_local_dir: ""
|
||||
node_exporter_binary_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/\
|
||||
node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
node_exporter_checksums_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/sha256sums.txt"
|
||||
|
||||
node_exporter_web_listen_address: "0.0.0.0:9100"
|
||||
node_exporter_web_telemetry_path: "/metrics"
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
- name: Download node_exporter binary to local folder
|
||||
become: false
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/\
|
||||
node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
url: "{{ node_exporter_binary_url }}"
|
||||
dest: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
|
||||
checksum: "sha256:{{ __node_exporter_checksum }}"
|
||||
mode: '0644'
|
||||
|
|
|
@ -86,8 +86,7 @@
|
|||
block:
|
||||
- name: Get checksum list from github
|
||||
ansible.builtin.set_fact:
|
||||
__node_exporter_checksums: "{{ lookup('url', 'https://github.com/prometheus/node_exporter/releases/download/v' + node_exporter_version +
|
||||
'/sha256sums.txt', wantlist=True) | list }}"
|
||||
__node_exporter_checksums: "{{ lookup('url', node_exporter_checksums_url, wantlist=True) | list }}"
|
||||
run_once: true
|
||||
until: __node_exporter_checksums is search('linux-' + go_arch + '.tar.gz')
|
||||
retries: 10
|
||||
|
|
Loading…
Reference in a new issue