forked from umanit/ansible-prometheus_exporter_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preflight.yml
39 lines (34 loc) · 1.28 KB
/
preflight.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- name: "preflight | Stat exporter_exporter binary"
ansible.builtin.stat:
path: "/usr/local/bin/exporter_exporter"
register: "_prometheus_proxy_is_installed"
- name: "preflight | Assert: prometheus_proxy_configuration is defined"
ansible.builtin.assert:
that:
- "prometheus_proxy_configuration"
fail_msg: "prometheus_proxy_configuration is empty"
quiet: true
- name: "preflight | Register exporter_exporter version"
ansible.builtin.shell:
cmd: >
set -o pipefail &&
/usr/local/bin/exporter_exporter --version 2>&1
| grep -oP 'Version: \K[0-9]+\.[0-9]+\.[0-9]+'
args:
executable: "/bin/bash"
changed_when: false
failed_when: false
register: "_prometheus_proxy_current_version_output"
- name: "Debug"
ansible.builtin.debug:
var: "_prometheus_proxy_current_version_output"
- name: "preflight | Set facts: _prometheus_proxy_installed_version"
ansible.builtin.set_fact:
_prometheus_proxy_installed_version: "{{ _prometheus_proxy_current_version_output.stdout }}"
_prometheus_proxy_is_installed: "{{ _prometheus_proxy_is_installed.stat.exists }}"
- name: "Debug"
ansible.builtin.debug:
msg:
- "Installed: {{ _prometheus_proxy_is_installed }}"
- "Version: {{ _prometheus_proxy_installed_version | default('-') }}"