46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
---
|
|
- name: Install Prometheus node-exporter
|
|
apt:
|
|
update_cache: true
|
|
name: prometheus-node-exporter
|
|
install_recommends: false # Do not install smartmontools
|
|
register: apt_result
|
|
retries: 3
|
|
until: apt_result is succeeded
|
|
|
|
- name: Install Prometheus node-exporter-collectors (bullseye)
|
|
apt:
|
|
update_cache: true
|
|
name: prometheus-node-exporter-collectors
|
|
install_recommends: false
|
|
register: apt_result
|
|
retries: 3
|
|
until: apt_result is succeeded
|
|
when:
|
|
- ansible_lsb.codename == 'bullseye'
|
|
|
|
- name: Make Prometheus node-exporter listen on adm only
|
|
lineinfile:
|
|
path: /etc/default/prometheus-node-exporter
|
|
regexp: '^ARGS='
|
|
line: |
|
|
ARGS="--web.listen-address={{ prometheus_node_exporter.listen_addr }}:9100"
|
|
tags: restart-node-exporter
|
|
|
|
- name: Activate prometheus-node-exporter service
|
|
systemd:
|
|
name: prometheus-node-exporter
|
|
enabled: true
|
|
state: started
|
|
|
|
# Install new APT textfile collector, it might be upstreamed one day
|
|
# https://github.com/prometheus-community/node-exporter-textfile-collector-scripts/pull/35
|
|
- name: Patch APT textfile collector
|
|
copy:
|
|
src: apt.sh
|
|
dest: /usr/share/prometheus-node-exporter/apt.sh
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
when: ansible_distribution_release != "bullseye"
|