enhancement(prometheus): supports multiple web listen addresses in preflight

this is for consistency with the other roles' preflight asserts for when
prometheus itself finally supports multiple web listen addresses

Signed-off-by: Christian Krause <christian.krause@idiv.de>
This commit is contained in:
Christian Krause 2023-09-04 11:07:00 +02:00
parent 4897b20b47
commit 762cb1d5f3
No known key found for this signature in database
GPG key ID: 3CD613B9A8567F58
4 changed files with 28 additions and 10 deletions

View file

@ -86,5 +86,5 @@ provisioner:
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115 # Blackbox exporter.
version: 2.25.2
prometheus_version: 2.25.2
prometheus_stop_timeout: 1min

View file

@ -6,9 +6,9 @@
- name: Download prometheus binary to local folder
become: false
ansible.builtin.get_url:
url: "https://github.com/prometheus/prometheus/releases/download/v{{ version\
\ }}/prometheus-{{ version }}.linux-amd64.tar.gz"
dest: "/tmp/prometheus-{{ version }}.linux-amd64.tar.gz"
url: "https://github.com/prometheus/prometheus/releases/download/v{{ prometheus_version\
\ }}/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
dest: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
mode: 0644
register: _download_archive
until: _download_archive is succeeded
@ -19,15 +19,15 @@
- name: Unpack prometheus binaries
become: false
ansible.builtin.unarchive:
src: "/tmp/prometheus-{{ version }}.linux-amd64.tar.gz"
src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64.tar.gz"
dest: "/tmp"
creates: "/tmp/prometheus-{{ version }}.linux-amd64/prometheus"
creates: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64/prometheus"
check_mode: false
- name: Link to prometheus binaries directory
become: false
ansible.builtin.file:
src: "/tmp/prometheus-{{ version }}.linux-amd64"
src: "/tmp/prometheus-{{ prometheus_version }}.linux-amd64"
dest: "/tmp/prometheus-linux-amd64"
state: link
check_mode: false

View file

@ -65,6 +65,8 @@ def test_service(host):
raise # Re-raise the original assertion error
def test_socket(host):
s = host.socket("tcp://127.0.0.1:9090")
assert s.is_listening
@pytest.mark.parametrize("sockets", [
"tcp://127.0.0.1:9090",
])
def test_socket(host, sockets):
assert host.socket(sockets).is_listening

View file

@ -20,6 +20,22 @@
ansible.builtin.package_facts:
when: "not 'packages' in ansible_facts"
- name: Assert that used version supports listen address type
ansible.builtin.assert:
that:
- >-
prometheus_web_listen_address is string
- name: Naive assertion of proper listen address
ansible.builtin.assert:
that:
- >-
[prometheus_web_listen_address] |
flatten |
reject('match', '.+:\\d+$') |
list |
length == 0
- name: Assert no duplicate config flags
ansible.builtin.assert:
that: