diff options
| author | Colin Wilk <colin@wilk.cx> | 2026-08-11 00:54:41 +0200 |
|---|---|---|
| committer | Colin Wilk <colin@wilk.cx> | 2026-08-11 00:54:41 +0200 |
| commit | c267536ecfbcf37e68226ade2ed29c3b1f356a98 (patch) | |
| tree | 0fb9728b0095dd34b873fa6c137b75c60734940d /README.md | |
| parent | c33948c219032977779a7ef6d82c16e84f37b81a (diff) | |
| download | ansible-role-prometheus-target-c267536ecfbcf37e68226ade2ed29c3b1f356a98.tar.gz ansible-role-prometheus-target-c267536ecfbcf37e68226ade2ed29c3b1f356a98.zip | |
Add `state` option for removing exporters
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -52,6 +52,7 @@ prometheus_target_exporter_defaults: {} # node_exporter: # path: /opt/prometheus/targets.yml # host: '{{ inventory_hostname }}:9100' + # state: present # labels: # Labels to match when using yaml strategy # severity: warning # job: external @@ -65,6 +66,17 @@ prometheus_target_exporter_defaults: {} prometheus_target_exporter: [] ``` +Each exporter accepts `state: present` or `state: absent`, defaulting to +`present`. Set `state: absent` to remove the rendered target from its target +file. The setting can be defined in `prometheus_target_exporter_defaults` and +overridden by an entry in `prometheus_target_exporter`. + +With the `yaml` strategy, removal searches every group in the configured file, +regardless of the exporter's labels, and removes groups left without targets. +With the `lineinfile` strategy, removal deletes the exact line produced by the +configured prefix, host, and suffix. Removing a target from a missing file is a +no-op for both strategies. + You can also add exporter that you want to have deployed without needing to specify them in the `prometheus_target_exporter` variable by adding them to the `prometheus_target_default_exporters` variable. |