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: # vim:ft=ansible:
--- ---
- hosts: tags_nagios - hosts: tags_nagios
gather_facts: no gather_facts: yes
tasks: tasks:
- name: assure nagios user - name: assure nagios user
ansible.builtin.user: name=nagios-checker state=absent remove=yes ansible.builtin.user: name=nagios-checker state=absent remove=yes
@ -10,36 +10,72 @@
- name: assure nagios user sudo rule file - name: assure nagios user sudo rule file
ansible.builtin.file: path=/etc/sudoers.d/50-nagios-checker state=absent ansible.builtin.file: path=/etc/sudoers.d/50-nagios-checker state=absent
tags: [ nagios, sudo ] tags: [ nagios, sudo ]
- name: assure prometheus node exporter - name: assure prometheus containers for docker hosts
# https://github.com/prometheus/node_exporter block:
ansible.builtin.docker_container: - name: assure prometheus node exporter
name: prometheus-node-exporter # https://github.com/prometheus/node_exporter
image: quay.io/prometheus/node-exporter:latest ansible.builtin.docker_container:
restart_policy: unless-stopped name: prometheus-node-exporter
command: image: quay.io/prometheus/node-exporter:latest
- '--path.rootfs=/host' restart_policy: unless-stopped
- '--collector.interrupts' command:
- '--collector.processes' - '--path.rootfs=/host'
network_mode: host - '--collector.interrupts'
pid_mode: host - '--collector.processes'
volumes: network_mode: host
- /:/host:ro,rslave pid_mode: host
tags: [ prometheus ] volumes:
- name: assure prometheus cadvisor exporter - /:/host:ro,rslave
ansible.builtin.docker_container: tags: [ prometheus ]
name: prometheus-cadvisor-exporter - name: assure prometheus cadvisor exporter
image: gcr.io/cadvisor/cadvisor:latest ansible.builtin.docker_container:
restart_policy: unless-stopped name: prometheus-cadvisor-exporter
ports: image: gcr.io/cadvisor/cadvisor:latest
- 9101:8080/tcp restart_policy: unless-stopped
volumes: ports:
- /:/rootfs:ro - 9101:8080/tcp
- /var/run:/var/run:ro volumes:
- /sys:/sys:ro - /:/rootfs:ro
- /var/lib/docker:/var/lib/docker:ro - /var/run:/var/run:ro
- /dev/disk:/dev/disk:ro - /sys:/sys:ro
devices: - /var/lib/docker:/var/lib/docker:ro
- /dev/kmsg - /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 - hosts: all
gather_facts: no gather_facts: no
tasks: tasks: