Merge pull request 'Install prometheus-node-exporter-collectors' (#65) from node_exporter_bullseye into master

Reviewed-on: Aurore/ansible#65
This commit is contained in:
jeltz 2021-09-24 01:54:43 +02:00
commit bae87c809e

View file

@ -23,6 +23,16 @@
when: when:
- ansible_lsb.codename == 'stretch' - 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 - name: Activate prometheus-node-exporter service
systemd: systemd:
name: prometheus-node-exporter name: prometheus-node-exporter
@ -37,55 +47,3 @@
line: | line: |
ARGS="--web.listen-address={{ ansible_hostname }}.adm.auro.re:9100" ARGS="--web.listen-address={{ ansible_hostname }}.adm.auro.re:9100"
notify: Restart prometheus-node-exporter 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'