mirror of
https://github.com/prometheus-community/ansible
synced 2024-11-10 06:14:13 +00:00
enhancement(smokeping_prober): allows using multiple web listen addresses
Signed-off-by: Christian Krause <christian.krause@idiv.de>
This commit is contained in:
parent
bb45a5d23c
commit
09f705ad00
5 changed files with 38 additions and 11 deletions
|
@ -6,7 +6,7 @@ smokeping_prober_binary_url: "https://github.com/{{ _smokeping_prober_repo }}/re
|
|||
smokeping_prober_checksums_url: "https://github.com/{{ _smokeping_prober_repo }}/releases/download/v{{ smokeping_prober_version }}/sha256sums.txt"
|
||||
smokeping_prober_skip_install: false
|
||||
|
||||
smokeping_prober_web_listen_address: ":9374"
|
||||
smokeping_prober_web_listen_address: "0.0.0.0:9374"
|
||||
smokeping_prober_web_telemetry_path: "/metrics"
|
||||
|
||||
# List of smokeping_prober targets.
|
||||
|
|
|
@ -4,7 +4,9 @@ provisioner:
|
|||
group_vars:
|
||||
all:
|
||||
smokeping_prober_binary_local_dir: "/tmp/smokeping_prober-linux-amd64"
|
||||
smokeping_prober_web_listen_address: "127.0.0.1:8080"
|
||||
smokeping_prober_web_listen_address:
|
||||
- '127.0.0.1:8080'
|
||||
- '127.0.1.1:8080'
|
||||
smokeping_prober_tls_server_config:
|
||||
cert_file: /etc/smokeping_prober/tls.cert
|
||||
key_file: /etc/smokeping_prober/tls.key
|
||||
|
@ -13,4 +15,4 @@ provisioner:
|
|||
smokeping_prober_basic_auth_users:
|
||||
randomuser: examplepassword
|
||||
go_arch: amd64
|
||||
smokeping_prober_version: 0.6.1
|
||||
smokeping_prober_version: 0.7.0
|
||||
|
|
|
@ -3,6 +3,7 @@ __metaclass__ = type
|
|||
|
||||
import os
|
||||
import testinfra.utils.ansible_runner
|
||||
import pytest
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
@ -37,10 +38,9 @@ def test_protecthome_property(host):
|
|||
assert p.get("ProtectHome") == "yes"
|
||||
|
||||
|
||||
def test_socket(host):
|
||||
sockets = [
|
||||
"tcp://127.0.0.1:8080"
|
||||
]
|
||||
for socket in sockets:
|
||||
s = host.socket(socket)
|
||||
assert s.is_listening
|
||||
@pytest.mark.parametrize("sockets", [
|
||||
"tcp://127.0.0.1:8080",
|
||||
"tcp://127.0.1.1:8080",
|
||||
])
|
||||
def test_socket(host, sockets):
|
||||
assert host.socket(sockets).is_listening
|
||||
|
|
|
@ -20,10 +20,26 @@
|
|||
ansible.builtin.package_facts:
|
||||
when: "not 'packages' in ansible_facts"
|
||||
|
||||
- name: Assert that used version supports listen address type
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- >-
|
||||
smokeping_prober_web_listen_address is string
|
||||
or
|
||||
(
|
||||
smokeping_prober_version is version('0.7.0', '>=') and
|
||||
smokeping_prober_web_listen_address | type_debug == "list"
|
||||
)
|
||||
|
||||
- name: Naive assertion of proper listen address
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "':' in smokeping_prober_web_listen_address"
|
||||
- >-
|
||||
[smokeping_prober_web_listen_address] |
|
||||
flatten |
|
||||
reject('match', '.+:\\d+$') |
|
||||
list |
|
||||
length == 0
|
||||
|
||||
- name: Assert that TLS config is correct
|
||||
when: smokeping_prober_tls_server_config | length > 0
|
||||
|
|
|
@ -13,7 +13,16 @@ PermissionsStartOnly=true
|
|||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecStart={{ smokeping_prober_binary_install_dir }}/smokeping_prober \
|
||||
--config.file={{ smokeping_prober_config_dir }}//{{ smokeping_prober_config_file }} \
|
||||
{% if smokeping_prober_version is version('0.7.0', '>=') and
|
||||
smokeping_prober_web_listen_address is iterable and
|
||||
smokeping_prober_web_listen_address is not mapping and
|
||||
smokeping_prober_web_listen_address is not string %}
|
||||
{% for address in smokeping_prober_web_listen_address %}
|
||||
--web.listen-address={{ address }}{{ " \\" if not loop.last else "" }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
--web.listen-address={{ smokeping_prober_web_listen_address }}
|
||||
{% endif %}
|
||||
|
||||
SyslogIdentifier=smokeping_prober
|
||||
KillMode=process
|
||||
|
|
Loading…
Reference in a new issue