Skip to content

Commit

Permalink
also make binary name customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
anarcat committed Sep 28, 2023
1 parent de91233 commit 8bc2a1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions roles/blackbox_exporter/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ blackbox_exporter_configuration_modules:
blackbox_exporter_config_dir: /etc/prometheus

blackbox_exporter_binary_install_dir: "/usr/local/bin"
blackbox_exporter_binary_name: "blackbox_exporter"

blackbox_exporter_service_name: blackbox_exporter
6 changes: 3 additions & 3 deletions roles/blackbox_exporter/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- name: Propagate blackbox_exporter binaries
ansible.builtin.copy:
src: "/tmp/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch }}/blackbox_exporter"
dest: "{{ blackbox_exporter_binary_install_dir }}/blackbox_exporter"
dest: "{{ blackbox_exporter_binary_install_dir }}/{{ blackbox_exporter_binary_name }}"
mode: 0755
owner: root
group: root
Expand All @@ -57,7 +57,7 @@
- name: Propagate locally distributed blackbox_exporter binary
ansible.builtin.copy:
src: "{{ blackbox_exporter_binary_local_dir }}/blackbox_exporter"
dest: "{{ blackbox_exporter_binary_install_dir }}/blackbox_exporter"
dest: "{{ blackbox_exporter_binary_install_dir }}/{{ blackbox_exporter_binary_name }}"
mode: '0755'
owner: root
group: root
Expand All @@ -78,7 +78,7 @@

- name: Ensure blackbox exporter binary has cap_net_raw capability
community.general.capabilities:
path: '{{ blackbox_exporter_binary_install_dir }}/blackbox_exporter'
path: '{{ blackbox_exporter_binary_install_dir }}/{{ blackbox_exporter_binary_name }}'
capability: cap_net_raw+ep
state: present
when: not ansible_check_mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ User={{ blackbox_exporter_user }}
Group={{ blackbox_exporter_group }}
PermissionsStartOnly=true
ExecReload=/bin/kill -HUP $MAINPID
ExecStart={{ blackbox_exporter_binary_install_dir }}/blackbox_exporter \
ExecStart={{ blackbox_exporter_binary_install_dir }}/{{ blackbox_exporter_binary_name }} \
--config.file={{ blackbox_exporter_config_dir }}/blackbox.yml \
{% for flag, flag_value in blackbox_exporter_cli_flags.items() -%}
--{{ flag }}={{ flag_value }} \
Expand Down

0 comments on commit 8bc2a1b

Please sign in to comment.