diff --git a/roles/systemd_exporter/tasks/preflight.yml b/roles/systemd_exporter/tasks/preflight.yml index e407c976..3e01e0c6 100644 --- a/roles/systemd_exporter/tasks/preflight.yml +++ b/roles/systemd_exporter/tasks/preflight.yml @@ -20,10 +20,21 @@ ansible.builtin.package_facts: when: "not 'packages' in ansible_facts" +- name: Assert that used version supports listen address type + ansible.builtin.assert: + that: + - >- + systemd_exporter_web_listen_address is string + - name: Naive assertion of proper listen address ansible.builtin.assert: that: - - "':' in systemd_exporter_web_listen_address" + - >- + [systemd_exporter_web_listen_address] | + flatten | + reject('match', '.+:\\d+$') | + list | + length == 0 - name: Assert that TLS config is correct when: systemd_exporter_tls_server_config | length > 0