From e236498f81eee24138b0451b078be7463da5582d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jadyn=20Emma=20J=C3=A4ger?= Date: Fri, 25 Aug 2023 20:54:14 +0200 Subject: [PATCH] fix(blackbox_exporter): ensure config dir is created and set default. --- roles/blackbox_exporter/defaults/main.yml | 2 +- roles/blackbox_exporter/tasks/install.yml | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/roles/blackbox_exporter/defaults/main.yml b/roles/blackbox_exporter/defaults/main.yml index 3cab3930f..696da11ca 100644 --- a/roles/blackbox_exporter/defaults/main.yml +++ b/roles/blackbox_exporter/defaults/main.yml @@ -77,6 +77,6 @@ blackbox_exporter_configuration_modules: # fail_if_matches_regexp: [test] # Where to put the blackbox_exporter.yml main configuration file -blackbox_exporter_config_dir: /etc +blackbox_exporter_config_dir: "/etc/blackbox_exporter" blackbox_exporter_binary_install_dir: "/usr/local/bin" diff --git a/roles/blackbox_exporter/tasks/install.yml b/roles/blackbox_exporter/tasks/install.yml index 5d951f90f..cf29a2a3a 100644 --- a/roles/blackbox_exporter/tasks/install.yml +++ b/roles/blackbox_exporter/tasks/install.yml @@ -15,6 +15,17 @@ createhome: false when: blackbox_exporter_user != 'root' +- name: Create blackbox_exporter configuration directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + owner: root + group: prometheus + mode: 0770 + with_items: + - "{{ blackbox_exporter_config_dir }}" + + - name: Get binary when: - blackbox_exporter_binary_local_dir | length == 0