From c267536ecfbcf37e68226ade2ed29c3b1f356a98 Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Tue, 11 Aug 2026 00:54:41 +0200 Subject: Add `state` option for removing exporters --- tasks/process_exporter.yml | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tasks/process_exporter.yml') diff --git a/tasks/process_exporter.yml b/tasks/process_exporter.yml index b4f33ba..0a19480 100644 --- a/tasks/process_exporter.yml +++ b/tasks/process_exporter.yml @@ -12,6 +12,13 @@ {{ (item.host if item.host is defined else _defaults.host) | mandatory }} _target_labels: >- {{ (_defaults.labels | default({})) | combine(item.labels | default({})) }} + _target_state: >- + {{ item.state if item.state is defined else (_defaults.state | default('present')) }} + +- name: Validate exporter state + ansible.builtin.assert: + that: _target_state in ["present", "absent"] + fail_msg: "Exporter state must be 'present' or 'absent', got '{{ _target_state }}'" - name: Execute strategy ansible.builtin.include_tasks: -- cgit v1.2.3