Skip to content

Commit

Permalink
make blackbox_exporter service name configuration
Browse files Browse the repository at this point in the history
This is for backwards compatibility with Debian packages.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
  • Loading branch information
anarcat committed Sep 30, 2023
1 parent 1225d28 commit 00aa1d2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions roles/blackbox_exporter/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ blackbox_exporter_configuration_modules:
blackbox_exporter_config_dir: /etc/blackbox_exporter

blackbox_exporter_binary_install_dir: "/usr/local/bin"

blackbox_exporter_service_name: blackbox_exporter
4 changes: 2 additions & 2 deletions roles/blackbox_exporter/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
become: true
ansible.builtin.systemd:
daemon_reload: true
name: blackbox_exporter
name: "{{ blackbox_exporter_service_name }}"
state: restarted

- name: Reload blackbox_exporter
listen: "reload blackbox_exporter"
become: true
ansible.builtin.systemd:
name: blackbox_exporter
name: "{{ blackbox_exporter_service_name }}"
state: reloaded
2 changes: 1 addition & 1 deletion roles/blackbox_exporter/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- name: Create systemd service unit
ansible.builtin.template:
src: blackbox_exporter.service.j2
dest: /etc/systemd/system/blackbox_exporter.service
dest: "/etc/systemd/system/{{ blackbox_exporter_service_name }}.service"
owner: root
group: root
mode: '0644'
Expand Down
2 changes: 1 addition & 1 deletion roles/blackbox_exporter/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
become: true
ansible.builtin.systemd:
daemon_reload: true
name: blackbox_exporter
name: "{{ blackbox_exporter_service_name }}"
state: started
enabled: true
tags:
Expand Down

0 comments on commit 00aa1d2

Please sign in to comment.