ansible/roles/prometheus_node/tasks/main.yml

50 lines
1.1 KiB
YAML
Raw Normal View History

2019-05-05 14:07:04 +02:00
---
2023-04-01 22:32:42 +02:00
- name: Install prometheus-node-exporter
2019-05-05 14:07:04 +02:00
apt:
2023-04-01 22:32:42 +02:00
name:
- prometheus-node-exporter
- prometheus-node-exporter-collectors
2019-11-01 14:16:32 +01:00
install_recommends: false # Do not install smartmontools
2023-04-04 01:28:51 +02:00
- 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
2023-04-01 22:32:42 +02:00
- name: Install smartmontools
2019-11-01 14:16:32 +01:00
apt:
2023-04-01 22:32:42 +02:00
name: smartmontools
2019-11-01 14:16:32 +01:00
when:
2023-04-01 22:32:42 +02:00
- "ansible_virtualization_role == 'host'"
2023-04-04 01:28:51 +02:00
- 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
2023-04-01 22:32:42 +02:00
- name: Enable prometheus-node-exporter
2019-07-22 20:56:43 +02:00
systemd:
name: prometheus-node-exporter
2019-07-22 21:04:58 +02:00
enabled: true
2019-07-22 20:56:43 +02:00
state: started
2023-04-01 22:32:42 +02:00
...