mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-10 06:14:13 +00:00
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:
parent
4897b20b47
commit
762cb1d5f3
4 changed files with 28 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue