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 /tasks/process_exporter.yml | |
| 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 'tasks/process_exporter.yml')
| -rw-r--r-- | tasks/process_exporter.yml | 7 |
1 files changed, 7 insertions, 0 deletions
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: |