From 3c92350df88f0f476243853358fd229e48f3221e Mon Sep 17 00:00:00 2001 From: gardar Date: Thu, 31 Oct 2024 15:54:29 +0000 Subject: [PATCH 1/2] refactor: use naive assertion of proper listen address from _common role Signed-off-by: gardar --- roles/nvidia_gpu_exporter/tasks/preflight.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/roles/nvidia_gpu_exporter/tasks/preflight.yml b/roles/nvidia_gpu_exporter/tasks/preflight.yml index bb83b54a..53f6193a 100644 --- a/roles/nvidia_gpu_exporter/tasks/preflight.yml +++ b/roles/nvidia_gpu_exporter/tasks/preflight.yml @@ -3,16 +3,8 @@ ansible.builtin.include_role: name: prometheus.prometheus._common tasks_from: preflight.yml - -- name: Naive assertion of proper listen address - ansible.builtin.assert: - that: - - >- - [nvidia_gpu_exporter_web_listen_address] | - flatten | - reject('match', '.+:\\d+$') | - list | - length == 0 + vars: + _common_web_listen_address: "{{ nvidia_gpu_exporter_web_listen_address }}" - name: Discover latest version ansible.builtin.set_fact: From 8e9ad10953c6cbb009cfbb04ea5921113d09de83 Mon Sep 17 00:00:00 2001 From: gardar Date: Thu, 31 Oct 2024 15:55:07 +0000 Subject: [PATCH 2/2] fix: lint Signed-off-by: gardar --- roles/nvidia_gpu_exporter/tasks/preflight.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/nvidia_gpu_exporter/tasks/preflight.yml b/roles/nvidia_gpu_exporter/tasks/preflight.yml index 53f6193a..593dfe42 100644 --- a/roles/nvidia_gpu_exporter/tasks/preflight.yml +++ b/roles/nvidia_gpu_exporter/tasks/preflight.yml @@ -8,8 +8,8 @@ - name: Discover latest version ansible.builtin.set_fact: - nvidia_gpu_exporter_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ _nvidia_gpu_exporter_repo }}/releases/latest', headers=_nvidia_gpu_exporter_github_api_headers, - split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" + nvidia_gpu_exporter_version: "{{ (lookup('url', 'https://api.github.com/repos/{{ _nvidia_gpu_exporter_repo }}/releases/latest', + headers=_nvidia_gpu_exporter_github_api_headers, split_lines=False) | from_json).get('tag_name') | replace('v', '') }}" run_once: true until: nvidia_gpu_exporter_version is version('0.0.0', '>=') retries: 10