Merge pull request #448 from gardar/nvidia_gpu_exporter/listen-address-assert

refactor(nvidia_gpu_exporter): move naive assertion to common role
This commit is contained in:
gardar 2024-10-31 16:41:38 +00:00 committed by GitHub
commit 35a94aa6fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,21 +3,13 @@
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:
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