49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
---
|
|
- name: Install prometheus-node-exporter
|
|
apt:
|
|
name:
|
|
- prometheus-node-exporter
|
|
- 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=rx,o=rx
|
|
|
|
- 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
|
|
enabled: true
|
|
state: started
|
|
...
|