aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/molecule
Commit message (Collapse)AuthorAgeFilesLines
* Fix pre-commit lint violationsColin Wilk3 days3-21/+32
|
* Add `state` option for removing exportersColin Wilk3 days4-6/+62
|
* test: expand Molecule coverage for exporter behaviorColin Wilk2026-07-215-23/+416
| | | | | | | | | | | | Cover lineinfile and YAML behavior for default exporters, skipped defaults, exporters without IDs, duplicate definitions, path and host overrides, path-prefix precedence, and inherited label overrides. Verify YAML handling of null documents, multiple files, labeled and unlabeled groups, and duplicate targets. Add test coverage for command and shell handlers using run-once, per-host, disabled, and non-become configurations.
* fix: prevent lost YAML targets during parallel writesColin Wilk2026-07-212-2/+30
| | | | | | | | | | | | | | | | | | | | The YAML strategy performed a separate read-modify-write operation for every managed host. Because these tasks were delegated to the same Prometheus host, parallel Ansible forks could read the same original file before any fork wrote its update. Each fork then generated YAML containing only its own target. Although the copy module atomically replaced the file, it did not make the full read-modify-write sequence atomic. The last fork to write therefore overwrote targets added by earlier forks. Collect exporter updates from all hosts through hostvars, process them in one run_once operation, and write each distinct target file once. This preserves every target without requiring users to set serial. Add parallel coverage for multiple target files and label groups, and reset the fixtures on every convergence so stale files cannot hide the race.
* test: split tests by strategyColin Wilk2026-07-215-178/+667
|
* refactor: bump and fix pre-commit errorsColin Wilk2026-07-033-73/+67
|
* Add run_once option for handlersColin Wilk2023-10-113-9/+26
| | | | | | | | | | | | | | This adds the run_once option for the two handler types (shell and command). The variables `prometheus_target_handler_command_run_once` and `prometheus_target_handler_shell_run_once` are introduced to control this behavior. For this change a switch from the Ansible Handlers to regular tasks was necessary to enforce run_once behavior with delegated hosts. If you don't rely on handler specific features such as deferring, nothing changes when using the role. Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Add ability to use exporter without id propertyv1.1.0Colin Wilk2023-06-152-0/+7
| | | | | | | | | | | | | | | | | The id property of the exporter is used for checking the default values specified in `prometheus_target_exporter_defaults` variable. However when both the `host` and the `path` fields are specified manually in the `prometheus_target_exporter` list this id is never looked up. The way the templating was handled however, still resulted in an error when leaving out the id field. The templating code was now rewritten to allow for the following exporter configuraion to run: prometheus_target_exporter: - { host: exporter_without_id, path: /opt/simple_target4.yml } Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Add ability to specify target path prefixColin Wilk2023-06-112-1/+65
| | | | | | | | This will decrease the amount of redundant configuration for users by allowing them to specify a general prefix on global / exporter / play level Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Add tests for hook functionality and lineinfile parametersColin Wilk2023-06-032-22/+130
| | | | Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Add alpine, rockylinux and fedora to testing pipelineColin Wilk2023-05-291-7/+18
| | | | | | Add more distros to CI/CD and include them in the galaxy meta file. Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Switch to 4 space indentation by default for lineinfile strategyColin Wilk2023-05-291-4/+4
| | | | | | | | | | | | | | | | | | This will change indentation in target files like: - labels: exporter: node targets: - host:9100 to - labels: exporter: node targets: - host:9100 Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Make prometheus_target_host a required variableColin Wilk2023-05-271-0/+1
| | | | Signed-off-by: Colin Wilk <colin.wilk@tum.de>
* Add molecule with some simple test casesColin Wilk2023-05-275-0/+111
Signed-off-by: Colin Wilk <colin.wilk@tum.de>