diff --git a/roles/bind_exporter/tasks/preflight.yml b/roles/bind_exporter/tasks/preflight.yml index 89a00e81..a130762c 100644 --- a/roles/bind_exporter/tasks/preflight.yml +++ b/roles/bind_exporter/tasks/preflight.yml @@ -20,17 +20,6 @@ ansible.builtin.package_facts: when: "not 'packages' in ansible_facts" -- name: Assert that used version supports listen address type - ansible.builtin.assert: - that: - - >- - bind_exporter_web_listen_address is string - or - ( - bind_exporter_version is version('0.15.0', '>=') and - bind_exporter_web_listen_address | type_debug == "list" - ) - - name: Naive assertion of proper listen address ansible.builtin.assert: that: diff --git a/roles/bind_exporter/templates/bind_exporter.service.j2 b/roles/bind_exporter/templates/bind_exporter.service.j2 index badee86a..ab5624ef 100644 --- a/roles/bind_exporter/templates/bind_exporter.service.j2 +++ b/roles/bind_exporter/templates/bind_exporter.service.j2 @@ -19,7 +19,15 @@ ExecStart={{ bind_exporter_binary_install_dir }}/bind_exporter \ --bind.timeout="{{ bind_exporter_timeout }}" \ --bind.pid-file="{{ bind_exporter_pid_file }}" \ --bind.stats-version={{ bind_exporter_stats_version }} \ +{% if bind_exporter_web_listen_address is iterable and + bind_exporter_web_listen_address is not mapping and + bind_exporter_web_listen_address is not string %} +{% for address in bind_exporter_web_listen_address %} + --web.listen-address={{ address }} \ +{% endfor %} +{% else %} --web.listen-address={{ bind_exporter_web_listen_address }} \ +{% endif %} --web.telemetry-path={{ bind_exporter_web_telemetry_path }}