node_exporter: Add OpenBSD support

This commit is contained in:
Timo Makinen 2023-08-20 14:32:15 +00:00
parent 3d0cf42e8e
commit 9025755695
2 changed files with 18 additions and 5 deletions

View file

@ -1,5 +1,5 @@
---
- name: Restart node_exporter
ansible.builtin.service:
name: prometheus-node-exporter
name: "{{ node_exporter_package }}"
state: restarted

View file

@ -1,12 +1,15 @@
---
- name: Include OS-specific variables
ansible.builtin.include_vars: "{{ ansible_os_family }}.yml"
- name: Install packages
ansible.builtin.package:
name: golang-github-prometheus-node-exporter
name: "{{ node_exporter_package }}"
state: installed
- name: Allow prometheus user to read private key
ansible.builtin.user:
name: prometheus
name: "{{ node_exporter_user }}"
groups: hostkey
append: true
notify: Restart node_exporter
@ -40,9 +43,19 @@
--web.config=/etc/node_exporter/web-config.yml
--collector.textfile.directory /var/lib/prometheus/node-exporter"
notify: Restart node_exporter
when: ansible_os_family == "RedHat"
- name: Enable node_exporter service
- name: Enable service
ansible.builtin.service:
name: prometheus-node-exporter
name: "{{ node_exporter_service }}"
state: started
enabled: true
arguments: --web.config.file=/etc/node_exporter/web-config.yml
when: ansible_os_family == "OpenBSD"
- name: Enable service
ansible.builtin.service:
name: "{{ node_exporter_service }}"
state: started
enabled: true
when: ansible_os_family == "RedHat"