Add some (admittedly crusty) support for podman for Prometheus monitoring

This commit is contained in:
Salt 2024-08-18 01:07:24 -05:00
parent f23d6ed738
commit 391e424199

View File

@ -2,7 +2,7 @@
# vim:ft=ansible:
---
- hosts: tags_nagios
gather_facts: no
gather_facts: yes
tasks:
- name: assure nagios user
ansible.builtin.user: name=nagios-checker state=absent remove=yes
@ -10,6 +10,8 @@
- name: assure nagios user sudo rule file
ansible.builtin.file: path=/etc/sudoers.d/50-nagios-checker state=absent
tags: [ nagios, sudo ]
- name: assure prometheus containers for docker hosts
block:
- name: assure prometheus node exporter
# https://github.com/prometheus/node_exporter
ansible.builtin.docker_container:
@ -40,6 +42,40 @@
- /dev/disk:/dev/disk:ro
devices:
- /dev/kmsg
when: ansible_pkg_mgr != "atomic_container"
- name: assure prometheus containers for coreos
block:
- name: assure prometheus node exporter
# https://github.com/prometheus/node_exporter
containers.podman.podman_container:
name: prometheus-node-exporter
image: quay.io/prometheus/node-exporter:latest
restart_policy: unless-stopped
command:
- '--path.rootfs=/host'
- '--collector.interrupts'
- '--collector.processes'
network_mode: host
pid_mode: host
volumes:
- /:/host:ro,rslave
tags: [ prometheus ]
- name: assure prometheus cadvisor exporter
containers.podman.podman_container:
name: prometheus-cadvisor-exporter
image: gcr.io/cadvisor/cadvisor:latest
restart_policy: unless-stopped
privileged: yes
ports:
- 9101:8080/tcp
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /dev/disk:/dev/disk:ro
device:
- /dev/kmsg
when: ansible_pkg_mgr == "atomic_container"
- hosts: all
gather_facts: no
tasks: