Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(nvidia_gpu_exporter): move naive assertion to common role #448

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions roles/nvidia_gpu_exporter/tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading