Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

offline support #70

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------|
| `blackbox_exporter_version` | 0.17.0 | Blackbox exporter package version |
| `blackbox_binary_local_dir` | "" | Allows to use local packages instead of ones distributed on github. As parameter it takes a directory where `blackbox_exporter` binary is stored on the ansible control node. |
| `blackbox_exporter_web_listen_address` | 0.0.0.0:9115 | Address on which blackbox exporter will be listening |
| `blackbox_exporter_cli_flags` | {} | Additional configuration flags passed to blackbox exporter binary at startup |
| `blackbox_exporter_configuration_modules` | http_2xx: { prober: http, timeout: 5s, http: '' } | |
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
blackbox_exporter_version: 0.17.0

blackbox_exporter_web_listen_address: "0.0.0.0:9115"
blackbox_exporter_binary_local_dir: ''

blackbox_exporter_cli_flags: {}
# blackbox_exporter_cli_flags:
Expand Down
52 changes: 32 additions & 20 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,41 @@
group: blackbox-exp
createhome: false

- name: download blackbox exporter binary to local folder
become: false
unarchive:
src: "https://github.com/prometheus/blackbox_exporter/releases/download/v{{ blackbox_exporter_version }}/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
dest: "/tmp"
remote_src: true
creates: "/tmp/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/blackbox_exporter"
register: _download_binary
until: _download_binary is succeeded
retries: 5
delay: 2
delegate_to: localhost
check_mode: false
- block:
- name: download blackbox exporter binary to local folder
become: false
unarchive:
src: "https://github.com/prometheus/blackbox_exporter/releases/download/v{{ blackbox_exporter_version }}/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}.tar.gz"
dest: "/tmp"
remote_src: true
creates: "/tmp/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/blackbox_exporter"
register: _download_binary
until: _download_binary is succeeded
retries: 5
delay: 2
delegate_to: localhost
check_mode: false

- name: propagate blackbox exporter binary
- name: propagate blackbox exporter binary
copy:
src: "/tmp/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/blackbox_exporter"
dest: "/usr/local/bin/blackbox_exporter"
mode: 0755
owner: root
group: root
notify:
- restart blackbox exporter
when: blackbox_exporter_binary_local_dir | length == 0

- name: propagate locally distributed blackbox_exporter binary
copy:
src: "/tmp/blackbox_exporter-{{ blackbox_exporter_version }}.linux-{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}/blackbox_exporter"
src: "{{ blackbox_exporter_binary_local_dir }}/blackbox_exporter"
dest: "/usr/local/bin/blackbox_exporter"
mode: 0750
owner: blackbox-exp
group: blackbox-exp
notify:
- restart blackbox exporter
mode: 0755
owner: root
group: root
when: blackbox_exporter_binary_local_dir | length > 0
notify: restart blackbox exporter

- name: Install libcap on Debian systems
package:
Expand Down