feature: Make config installation dir configurable (#173)

* feature: Make config installation dir configurable

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>

* fix: blackbox_exporter_config_dir consistent

- Made blackbox_exporter_config_dir parameter consistent with other
  collection roles
- Added new parameter to meta/argument_specs.yml

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>

---------

Signed-off-by: Thomas Venieris <thomas.venieris@gmail.com>
This commit is contained in:
Thomas Venieris 2023-07-29 17:43:24 +02:00 committed by GitHub
parent 603aa0c46a
commit 791b9b1290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -68,3 +68,6 @@ blackbox_exporter_configuration_modules:
# preferred_ip_protocol: ip6
# validate_answer_rrs:
# fail_if_matches_regexp: [test]
# Where to put the blackbox_exporter.yml main configuration file
blackbox_exporter_config_dir: /etc

View file

@ -34,3 +34,6 @@ argument_specs:
http:
method: GET
valid_status_codes: []
blackbox_exporter_config_dir:
description: "Directory where the blackbox exporter configuration file is placed"
default: "/etc"

View file

@ -12,7 +12,7 @@
- name: Configure blackbox exporter
ansible.builtin.template:
src: blackbox_exporter.yml.j2
dest: /etc/blackbox_exporter.yml
dest: "{{ blackbox_exporter_config_dir }}/blackbox_exporter.yml"
owner: root
group: "{{ blackbox_exporter_group }}"
mode: 0644

View file

@ -12,7 +12,7 @@ Group={{ blackbox_exporter_group }}
PermissionsStartOnly=true
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/blackbox_exporter \
--config.file=/etc/blackbox_exporter.yml \
--config.file={{ blackbox_exporter_config_dir }}/blackbox_exporter.yml \
{% for flag, flag_value in blackbox_exporter_cli_flags.items() -%}
--{{ flag }}={{ flag_value }} \
{% endfor -%}