blackbox_exporter: Initial version of role
This commit is contained in:
parent
bb8b486263
commit
dc2a6f5788
4 changed files with 72 additions and 0 deletions
17
roles/blackbox_exporter/files/blackbox.yml
Normal file
17
roles/blackbox_exporter/files/blackbox.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
modules:
|
||||||
|
http:
|
||||||
|
prober: http
|
||||||
|
http:
|
||||||
|
valid_status_codes:
|
||||||
|
- 200
|
||||||
|
- 401
|
||||||
|
- 403
|
||||||
|
ssh:
|
||||||
|
prober: tcp
|
||||||
|
tcp:
|
||||||
|
query_response:
|
||||||
|
- expect: "^SSH-2.0-"
|
||||||
|
- send: "SSH-2.0-blackbox-ssh-check"
|
||||||
|
tcp:
|
||||||
|
prober: tcp
|
5
roles/blackbox_exporter/handlers/main.yml
Normal file
5
roles/blackbox_exporter/handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: Restart blackbox_exporter
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: blackbox_exporter
|
||||||
|
state: restarted
|
39
roles/blackbox_exporter/tasks/main.yml
Normal file
39
roles/blackbox_exporter/tasks/main.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
- name: Install packages
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: blackbox_exporter
|
||||||
|
state: installed
|
||||||
|
|
||||||
|
- name: Add user to hostkey group
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: _blackboxexporter
|
||||||
|
groups: hostkey
|
||||||
|
append: true
|
||||||
|
notify: Restart blackbox_exporter
|
||||||
|
|
||||||
|
- name: Create main config
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /etc/blackbox_exporter/blackbox.yml
|
||||||
|
src: blackbox.yml
|
||||||
|
mode: "0644"
|
||||||
|
owner: root
|
||||||
|
group: "{{ ansible_wheel }}"
|
||||||
|
notify: Restart blackbox_exporter
|
||||||
|
|
||||||
|
- name: Create web-config
|
||||||
|
ansible.builtin.template:
|
||||||
|
dest: /etc/blackbox_exporter/web-config.yml
|
||||||
|
src: web-config.yml.j2
|
||||||
|
mode: "0644"
|
||||||
|
owner: root
|
||||||
|
group: "{{ ansible_wheel }}"
|
||||||
|
notify: Restart blackbox_exporter
|
||||||
|
|
||||||
|
- name: Enable service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: blackbox_exporter
|
||||||
|
state: started
|
||||||
|
arguments: >
|
||||||
|
--config.file=/etc/blackbox_exporter/blackbox.yml
|
||||||
|
--web.config.file=/etc/blackbox_exporter/web-config.yml
|
||||||
|
enabled: true
|
11
roles/blackbox_exporter/templates/web-config.yml.j2
Normal file
11
roles/blackbox_exporter/templates/web-config.yml.j2
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
tls_server_config:
|
||||||
|
key_file: {{ tls_private }}/{{ inventory_hostname }}.key
|
||||||
|
cert_file: {{ tls_certs }}/{{ inventory_hostname }}.crt
|
||||||
|
client_ca_file: {{ tls_certs }}/ca.crt
|
||||||
|
client_auth_type: RequireAndVerifyClientCert
|
||||||
|
client_allowed_sans:
|
||||||
|
{% for host in groups['prometheus'] %}
|
||||||
|
- {{ host }}
|
||||||
|
{% endfor %}
|
||||||
|
min_version: TLS13
|
Loading…
Add table
Add a link
Reference in a new issue