feat(blackbox_exporter): add web_config option

Signed-off-by: Jadyn Emma Jäger <jadyn@jadyn.dev>
This commit is contained in:
Jadyn Emma Jäger 2023-08-25 20:42:47 +02:00
parent f3514a9e97
commit 10a6492e0b
No known key found for this signature in database
GPG key ID: 632410170049FDDA
4 changed files with 14 additions and 0 deletions

View file

@ -5,6 +5,11 @@ blackbox_exporter_binary_url: "https://github.com/{{ _blackbox_exporter_repo }}/
blackbox_exporter_checksums_url: "https://github.com/{{ _blackbox_exporter_repo }}/releases/download/v{{ blackbox_exporter_version }}/sha256sums.txt" blackbox_exporter_checksums_url: "https://github.com/{{ _blackbox_exporter_repo }}/releases/download/v{{ blackbox_exporter_version }}/sha256sums.txt"
blackbox_exporter_web_listen_address: "0.0.0.0:9115" blackbox_exporter_web_listen_address: "0.0.0.0:9115"
blackbox_exporter_web_config:
tls_server_config: {}
http_server_config: {}
basic_auth_users: {}
blackbox_exporter_system_user: blackbox-exp blackbox_exporter_system_user: blackbox-exp
blackbox_exporter_system_group: "{{ blackbox_exporter_system_user }}" blackbox_exporter_system_group: "{{ blackbox_exporter_system_user }}"

View file

@ -50,3 +50,6 @@ argument_specs:
blackbox_exporter_local_cache_path: blackbox_exporter_local_cache_path:
description: 'Local path to stash the archive and its extraction' description: 'Local path to stash the archive and its extraction'
default: "/tmp/blackbox_exporter-{{ ansible_system | lower }}-{{ _blackbox_exporter_go_ansible_arch }}/{{ blackbox_exporter_version }}" default: "/tmp/blackbox_exporter-{{ ansible_system | lower }}-{{ _blackbox_exporter_go_ansible_arch }}/{{ blackbox_exporter_version }}"
blackbox_exporter_web_config:
description: "A Prometheus L(web config yaml,https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md) for configuring TLS and auth."
type: "dict"

View file

@ -7,6 +7,9 @@
_common_system_user: "{{ blackbox_exporter_system_user }}" _common_system_user: "{{ blackbox_exporter_system_user }}"
_common_system_group: "{{ blackbox_exporter_system_group }}" _common_system_group: "{{ blackbox_exporter_system_group }}"
_common_config_dir: "{{ blackbox_exporter_config_dir }}" _common_config_dir: "{{ blackbox_exporter_config_dir }}"
_common_tls_server_config: "{{ blackbox_exporter_web_config.tls_server_config }}"
_common_http_server_config: "{{ blackbox_exporter_web_config.http_server_config }}"
_common_basic_auth_users: "{{ blackbox_exporter_web_config.basic_auth_users }}"
tags: tags:
- blackbox_exporter - blackbox_exporter
- configure - configure

View file

@ -13,6 +13,9 @@ PermissionsStartOnly=true
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
ExecStart={{ blackbox_exporter_binary_install_dir }}/blackbox_exporter \ ExecStart={{ blackbox_exporter_binary_install_dir }}/blackbox_exporter \
--config.file={{ blackbox_exporter_config_dir }}/blackbox_exporter.yml \ --config.file={{ blackbox_exporter_config_dir }}/blackbox_exporter.yml \
{% if blackbox_exporter_web_config.values() | map('length') | select('gt', 0) | list is any %}
--web.config.file={{ blackbox_exporter_config_dir }}/web_config.yml \
{% endif %}
{% for flag, flag_value in blackbox_exporter_cli_flags.items() -%} {% for flag, flag_value in blackbox_exporter_cli_flags.items() -%}
--{{ flag }}={{ flag_value }} \ --{{ flag }}={{ flag_value }} \
{% endfor -%} {% endfor -%}