Install prometheus-node-exporter-collectors

This commit is contained in:
jeltz 2021-09-24 01:41:01 +02:00
parent 4a594bf1cc
commit 8b54121a87

View file

@ -23,6 +23,16 @@
when:
- ansible_lsb.codename == 'stretch'
- 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_facts['lsb']['codename'] == 'bullseye'
- name: Activate prometheus-node-exporter service
systemd:
name: prometheus-node-exporter
@ -37,55 +47,3 @@
line: |
ARGS="--web.listen-address={{ ansible_hostname }}.adm.auro.re:9100"
notify: Restart prometheus-node-exporter
- name: Add monitoring for apt on bullseye
block:
- name: Install moreutils # we need the sponge command
apt:
name:
- moreutils
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Ensure /usr/share/prometheus-node-exporter exist
file:
path: /usr/share/prometheus-node-exporter/
state: directory
group: root
owner: root
mode: u=rwx,g=rx,o=rx
- name: Add the script
copy:
src: apt.sh
dest: /usr/share/prometheus-node-exporter/apt.sh
group: root
owner: root
mode: u=rwx,g=rx,o=rx
- name: Add the timer
copy:
src: prometheus-node-exporter-apt.timer
dest: /lib/systemd/system/prometheus-node-exporter-apt.timer
group: root
owner: root
mode: u=rw,g=r,o=r
- name: Add the service
copy:
src: prometheus-node-exporter-apt.service
dest: /lib/systemd/system/prometheus-node-exporter-apt.service
group: root
owner: root
mode: u=rw,g=r,o=r
- name: Enable the timer
systemd:
name: prometheus-node-exporter-apt.timer
state: started
enabled: true
when: ansible_facts['lsb']['codename'] == 'bullseye'