Skip to content
Snippets Groups Projects
Commit 18924185 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Merge branch 'th/node-exporter-k8s' into 'main'

node_exporter: Configure k8s Prometheus scraping

See merge request !3
parents 421e4947 e3e090fd
Branches main
No related tags found
1 merge request!3node_exporter: Configure k8s Prometheus scraping
Pipeline #4793 passed
......@@ -54,7 +54,7 @@
- prometheus-exporter
- config
- name: Configure Prometheus server to scrape us
- name: Configure Prometheus server to scrape us (file)
ansible.builtin.template:
src: scrape.yml.j2
dest: "/etc/prometheus/scrape/node_{{ ansible_fqdn }}.yml"
......@@ -66,6 +66,27 @@
- prometheus
- prometheus-exporter
- config
when: prometheus_host is defined
- name: Configure Prometheus server to scrape us (k8s)
kubernetes.core.k8s:
definition:
apiVersion: v1
kind: ConfigMap
metadata:
name: "{{ prometheus_k8s_scrape.name }}"
namespace: "{{ prometheus_k8s_scrape.namespace }}"
data: "{{ _data|items2dict }}"
vars:
_data:
- key: "node_{{ ansible_fqdn }}.yml"
value: "{{ lookup('template', 'scrape.yml.j2') }}"
delegate_to: localhost
tags:
- prometheus
- prometheus-exporter
- config
when: prometheus_k8s_scrape is defined
- name: Configure needrestart integration
ansible.builtin.import_tasks: needrestart.yml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment