prometheus_node: collect textfiles
This commit is contained in:
parent
94953e1aa7
commit
e160b98f0e
4 changed files with 50 additions and 0 deletions
10
roles/prometheus_node/handlers/main.yml
Normal file
10
roles/prometheus_node/handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Run daemon-reload
|
||||
systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart prometheus-node-exporter
|
||||
systemd:
|
||||
name: prometheus-node-exporter.service
|
||||
state: restarted
|
||||
...
|
|
@ -6,12 +6,41 @@
|
|||
- prometheus-node-exporter-collectors
|
||||
install_recommends: false # Do not install smartmontools
|
||||
|
||||
- name: Configure prometheus-node-exporter
|
||||
template:
|
||||
src: default.j2
|
||||
dest: /etc/default/prometheus-node-exporter
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
notify:
|
||||
- Restart prometheus-node-exporter
|
||||
|
||||
- name: Install smartmontools
|
||||
apt:
|
||||
name: smartmontools
|
||||
when:
|
||||
- "ansible_virtualization_role == 'host'"
|
||||
|
||||
- name: Create override directory
|
||||
file:
|
||||
path: /etc/systemd/system/prometheus-node-exporter.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rwx,g=rw,o=rw
|
||||
|
||||
- name: Override prometheus-node-exporter.service
|
||||
template:
|
||||
src: override.conf.j2
|
||||
dest: /etc/systemd/system/prometheus-node-exporter.service.d/override.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: u=rw,g=r,o=r
|
||||
notify:
|
||||
- Run daemon-reload
|
||||
- Restart prometheus-node-exporter
|
||||
|
||||
- name: Enable prometheus-node-exporter
|
||||
systemd:
|
||||
name: prometheus-node-exporter
|
||||
|
|
7
roles/prometheus_node/templates/default.j2
Normal file
7
roles/prometheus_node/templates/default.j2
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
{% if prometheus_node__text_dir is defined %}
|
||||
ARGS="--collector.textfile.directory={{ prometheus_node__text_dir | quote }}"
|
||||
{% else %}
|
||||
ARGS=""
|
||||
{% endif %}
|
4
roles/prometheus_node/templates/override.conf.j2
Normal file
4
roles/prometheus_node/templates/override.conf.j2
Normal file
|
@ -0,0 +1,4 @@
|
|||
{{ ansible_managed | comment }}
|
||||
|
||||
[Service]
|
||||
RuntimeDirectory=prometheus-node-exporter
|
Loading…
Reference in a new issue